private boolean readBuffer ( InputStream is , byte [ ] dest , int start , int want ) throws IOException { int done = 0 ; while ( done < want ) { int got = is . read ( dest , start + done , want - done ) ; if ( got < 0 ) return false ; done += got ; } if ( showRead ) System . out . println ( "Read buffer at " + bytesRead + " len=" + done ) ; bytesRead += done ; return true ; }
read into dest byte array until buffer is full or end of stream