cdm/src/main/java/ucar/unidata/io/RandomAccessFile.java
public final void readFully(byte b[], int off, int len) throws IOException {
    int n = 0;
    while (n < len) {
      int count = this.read(b, off + n, len - n);
      if (count < 0) {
        throw new EOFException("Reading "+location+" at "+filePosition+" file length = "+length());
      }
      n += count;
    }
  }
public final void readFully(byte b[], int off, int len) throws IOException {
    int n = 0;
    while (n < len) {
      int count = this.read(b, off + n, len - n);
      if (count < 0) {
        throw new EOFException("Reading "+location+" at "+filePosition+" file length = "+length());
      }
      n += count;
    }
  }
Reads exactly <code>len</code> bytes from this file into the byte
array. This method reads repeatedly from the file until all the
bytes are read. This method blocks until all the bytes are read,
the end of the stream is detected, or an exception is thrown.

@param b   the buffer into which the data is read.
@param off the start offset of the data.
@param len the number of bytes to read.
@throws EOFException if this file reaches the end before reading
all the bytes.
@throws IOException  if an I/O error occurs.