cdm/src/main/java/ucar/unidata/io/RandomAccessFile.java
public long length() throws IOException {
    long fileLength = (file == null) ? -1L : file.length(); // GRIB has closed the data raf
    if (fileLength < dataEnd) {
      return dataEnd;
    } else {
      return fileLength;
    }
  }
public long length() throws IOException {
    long fileLength = (file == null) ? -1L : file.length(); // GRIB has closed the data raf
    if (fileLength < dataEnd) {
      return dataEnd;
    } else {
      return fileLength;
    }
  }
Get the length of the file. The data in the buffer (which may not
have been written the disk yet) is taken into account.

@return the length of the file in bytes.
@throws IOException if an I/O error occurrs.