read() method reads a byte at a time.
This is less than perfectly efficient. The following two
overloaded variants read multiple bytes into an array of bytes.
public int read(byte data) throws IOException public int read(byte data, int offset, int length) throws IOException
The first method tries to read enough bytes to fill the array
b. The second method reads
bytes from the input stream and stores them into the array
b starting at position
These methods block until there is some data available. Then
they read as many bytes as they can into
until they've read
These methods then return the number of bytes actually read. You
should not assume that the array will be filled or that
length bytes will actually have been read. If the
end of stream is encountered, -1 is returned.