cdm/src/main/java/ucar/nc2/util/IO.java
static public long copy2null(InputStream in, int buffersize) throws IOException {
    long totalBytesRead = 0;
    if (buffersize <= 0) buffersize = default_file_buffersize;
    byte[] buffer = new byte[buffersize];
    while (true) {
      int n = in.read(buffer);
      if (n == -1) break;
      totalBytesRead += n;
    }
    // if (fout != null) fout.format("done=%d %n",totalBytesRead);
    return totalBytesRead;
  }
static public long copy2null(InputStream in, int buffersize) throws IOException {
    long totalBytesRead = 0;
    if (buffersize <= 0) buffersize = default_file_buffersize;
    byte[] buffer = new byte[buffersize];
    while (true) {
      int n = in.read(buffer);
      if (n == -1) break;
      totalBytesRead += n;
    }
    // if (fout != null) fout.format("done=%d %n",totalBytesRead);
    return totalBytesRead;
  }
static public long copy2null ( InputStream in , int buffersize ) throws IOException { long totalBytesRead = 0 ; if ( buffersize <= 0 ) buffersize = default_file_buffersize ; byte [ ] buffer = new byte [ buffersize ] ; while ( true ) { int n = in . read ( buffer ) ; if ( n == - 1 ) break ; totalBytesRead += n ; } // if (fout != null) fout.format("done=%d %n",totalBytesRead);
 return totalBytesRead ; }
copy all bytes from in and throw them away.

@param in  InputStream
@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
copy all bytes from in and throw them away .