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.
It's more efficient to read multiple bytes at a time:
public int read(byte data) throws IOException public int read(byte data, int offset, int length) throws IOException
These methods block until there is some data available. Then
they read as many bytes as they can into
until they've read
Each returns the number of bytes actually read or -1 on end of stream.