cdm/src/main/java/ucar/unidata/io/http/HTTPRandomAccessFile.java
@Override
  protected int read_(long pos, byte[] buff, int offset, int len) throws IOException {
    long end = pos + len - 1;
    if (end >= total_length)
      end = total_length - 1;

    if (debug) System.out.println(" HTTPRandomAccessFile bytes=" + pos + "-" + end + ": ");

    try (HTTPMethod method = HTTPFactory.Get(session,url)) {
      method.setFollowRedirects(true);
      method.setRange(pos,end);
      doConnect(method);

      int code = method.getStatusCode();
      if (code != 206)
        throw new IOException("Server does not support Range requests, code= " + code);

      String s = method.getResponseHeader("Content-Length").getValue();
      if (s == null)
        throw new IOException("Server does not send Content-Length header");

      int readLen = Integer.parseInt(s);
      readLen = Math.min(len, readLen);

      InputStream is = method.getResponseAsStream();
      readLen = copy(is, buff, offset, readLen);
      return readLen;

    }
  }
@Override
  protected int read_(long pos, byte[] buff, int offset, int len) throws IOException {
    long end = pos + len - 1;
    if (end >= total_length)
      end = total_length - 1;

    if (debug) System.out.println(" HTTPRandomAccessFile bytes=" + pos + "-" + end + ": ");

    try (HTTPMethod method = HTTPFactory.Get(session,url)) {
      method.setFollowRedirects(true);
      method.setRange(pos,end);
      doConnect(method);

      int code = method.getStatusCode();
      if (code != 206)
        throw new IOException("Server does not support Range requests, code= " + code);

      String s = method.getResponseHeader("Content-Length").getValue();
      if (s == null)
        throw new IOException("Server does not send Content-Length header");

      int readLen = Integer.parseInt(s);
      readLen = Math.min(len, readLen);

      InputStream is = method.getResponseAsStream();
      readLen = copy(is, buff, offset, readLen);
      return readLen;

    }
  }
@ Override protected int read_ ( long pos , byte [ ] buff , int offset , int len ) throws IOException { long end = pos + len - 1 ; if ( end >= total_length ) end = total_length - 1 ; if ( debug ) System . out . println ( " HTTPRandomAccessFile bytes=" + pos + "-" + end + ": " ) ; try ( HTTPMethod method = HTTPFactory . Get ( session , url ) ) { method . setFollowRedirects ( true ) ; method . setRange ( pos , end ) ; doConnect ( method ) ; int code = method . getStatusCode ( ) ; if ( code != 206 ) throw new IOException ( "Server does not support Range requests, code= " + code ) ; String s = method . getResponseHeader ( "Content-Length" ) . getValue ( ) ; if ( s == null ) throw new IOException ( "Server does not send Content-Length header" ) ; int readLen = Integer . parseInt ( s ) ; readLen = Math . min ( len , readLen ) ; InputStream is = method . getResponseAsStream ( ) ; readLen = copy ( is , buff , offset , readLen ) ; return readLen ; } }
Read directly from file, without going through the buffer.
All reading goes through here or readToByteChannel;

@param pos    start here in the file
@param buff   put data into this buffer
@param offset buffer offset
@param len    this number of bytes
@return actual number of bytes read
@throws IOException on io error
Read directly from file without going through the buffer . All reading goes through here or readToByteChannel ;