In this case we call FileOutputStream.write(byte[]) so the array should be output in one shot.
Gary On Sep 25, 2011, at 13:59, "Daniel Pitts" <dan...@coloraura.com> wrote: > Buffering is important if you are writing many small chunks in a row. I > haven't looked at the implementation of writeByteArrayToFile, but I'm > assuming it the entire byte array in one shot and then closes the stream. > Buffering would actually add extra overhead, as it would copy the byte array > into another buffer, and the write that to the final output stream. > > On Sun, Sep 25, 2011 at 9:45 AM, Timo Rumland <timo.ruml...@the-cr.de>wrote: > >> Hello everyone, >> >> sorry to bump this, but does anyone not have a comment to my question? >> I really think I missed something, I can't imagine that the Commons IO >> "forgot" to buffer the bytes that should be written to a file. >> >> Please see my original question below. >> >> Thanks a lot! >> >> ------------------------------------- >> >>> Hello, >> >>> I recently started using the FileUtils class of Commons IO, and had a >>> quick look into the source code. >> >>> The method "FileUtils.writeByteArrayToFile(...)" internally uses the >>> private method "openOutputStream(...)", which creates (after some >>> smart checks) an FileOutputStream. >> >>> But, shouldn't "writeByteArrayToFile(...)" or "openOutputStream(...)" >>> not use/create a BufferedOutputStream, wrapping the FileOutputStream? >> >>> Or do I overlook something? >> >>> I think one should always buffer the bytes when writing to a file... >> >>> Any thoughts? >> >>> Thanks ! >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org >> For additional commands, e-mail: user-h...@commons.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org