cdm/src/main/java/ucar/nc2/util/IO.java
static public long copy2null(FileChannel in, int buffersize) throws IOException {
    long totalBytesRead = 0;
    if (buffersize <= 0) buffersize = default_file_buffersize;
    ByteBuffer buffer = ByteBuffer.allocate( buffersize);
    while (true) {
      int n = in.read(buffer);
      if (n == -1) break;
      totalBytesRead += n;
      buffer.flip();
    }
    return totalBytesRead;
  }
static public long copy2null(FileChannel in, int buffersize) throws IOException {
    long totalBytesRead = 0;
    if (buffersize <= 0) buffersize = default_file_buffersize;
    ByteBuffer buffer = ByteBuffer.allocate( buffersize);
    while (true) {
      int n = in.read(buffer);
      if (n == -1) break;
      totalBytesRead += n;
      buffer.flip();
    }
    return totalBytesRead;
  }
copy all bytes from in and throw them away.

@param in  FileChannel
@param buffersize size of buffer to use, if -1 uses default value (9200)
@return number of bytes copied
@throws java.io.IOException on io error