@ Override public int read ( byte [ ] data , int offset , int length ) throws IOException { final StringBuilder s = read ( length ) ; int n = 0 ; for ( int i = 0 ; i < Math . min ( length , s . length ( ) ) ; i ++ ) { data [ offset + i ] = ( byte ) s . charAt ( i ) ; n += 1 ; } given ( s , length , n ) ; return n > 0 ? n : - 1 ; }
Reads the next length of bytes from the stream into the given byte array at the given offset .