public static void readFully(Input in,long position,byte[] buffer,int offset,int length) throws IOException {
  int nread=0;
  while (nread < length) {
    int nbytes=in.read(position + nread,buffer,offset + nread,length - nread);
    if (nbytes < 0) {
      throw new IOException("End of stream reached before reading fully.");
    }
    nread+=nbytes;
  }
}

public static void readFully ( Input in , long position , byte [ ] buffer , int offset , int length ) throws IOException { int nread = 0 ; while ( nread < length ) { int nbytes = in . read ( position + nread , buffer , offset + nread , length - nread ) ; if ( nbytes < 0 ) { throw new IOException ( "End of stream reached before reading fully." ) ; } nread += nbytes ; } }
does the readfully based on input ' s positioned read . this does not change the current offset of the stream and is thread - safe .
