question: public static int readAmount ( InputStream is , byte [ ] buf , int offset , int length ) throws IOException { int read = 0 ; int len ; while ( read < length && ( len = is . read ( buf , offset + read , length - read ) ) > 0 ) { read += len ; } return read ; }
target:  Reads specified amount of data from stream or amount left in stream.