code: protected byte[] readByteArray(InputStream is, int size) throws IOException
     {
        byte[] buffer = new byte[size];
        if (is.read(buffer) != buffer.length)
        {
           throw new EOFException();
        }
        return (buffer);
     }
docs: This method reads a byte array from the input stream.
  
  @param is the input stream
  @param size number of bytes to read
  @return byte array
  @throws IOException on file read error or EOF