question: public static int readFully ( InputStream in , byte [ ] buffer , int max ) throws IOException { try { int result = 0 , len = Math . min ( max , buffer . length ) ; while ( len > 0 ) { int l = in . read ( buffer , result , len ) ; if ( l < 0 ) { break ; } result += l ; len -= l ; } return result ; } catch ( Exception e ) { throw DbException . convertToIOException ( e ) ; } }
target:  Try to read the given number of bytes to the buffer. This method reads until the maximum number of bytes have been read or until the end of file.