question: protected int readFully ( InputStream in , byte buffer [ ] ) throws java . io . IOException { for ( int i = 0 ; i < buffer . length ; i ++ ) { int q = in . read ( ) ; if ( q == - 1 ) return i ; buffer [ i ] = ( byte ) q ; } return buffer . length ; }
target:  This method works around the bizarre semantics of BufferedInputStream's read method.