public static void readbytes_into ( InputStream input , byte [ ] buffer , int offset , int length ) throws IOException { while ( length > 0 ) { int read = input . read ( buffer , offset , length ) ; if ( read == - 1 ) throw new IOException ( "expected more bytes in input stream" ) ; offset += read ; length -= read ; } }
read a number of signed bytes into the specified location in an existing byte array