This week's book giveaways are in the Scala and Android forums. We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line! See this thread and this one for details.
First of all, hello everybody!
My question also applies to output streams and writes.
Granted I have something like that
is there any advantage in creating a byte buffer and reading a file with read(byte) method, as opposed to reading it byte by byte?
My guess is no, since we are simply transferring bytes from one point in memory to another and the compiler can optimize it.
Also, did i put anything redundant into that code?:
I'm no expert on this, so wait for confirmation from one before you take this as gospel, but I thought that the ability to read in data as chunks rather than byte by byte was the whole reason for the existence of the BufferedInputStream class. So if I understand things correctly, you are better off using the read(byte b, int off, int len) overload.