question: private static void read ( InputStream in , byte [ ] buf , int pos , int n ) throws IOException { int read = 0 ; int res = 0 ; while ( read < n ) { res = in . read ( buf , read + pos , n - read ) ; if ( res > 0 ) { read += res ; } else { throw new IOException ( "Read failed, got " + read + " of " + n ) ; } } }
target:  Read at least the specified amount of bytes, and place them in the input buffer.