public void read ( byte [ ] holder ) throws ProtocolException { int readTotal = 0 ; try { while ( readTotal < holder . length ) { int count = input . read ( holder , readTotal , holder . length - readTotal ) ; if ( count == - 1 ) { throw new ProtocolException ( "Unexpected end of stream." ) ; } readTotal += count ; } // Unset the next char. nextSeen = false ; nextChar = 0 ; } catch ( IOException e ) { throw new ProtocolException ( "Error reading from stream." , e ) ; } }
Reads and consumes a number of characters from the underlying reader filling the byte array provided .