code: @Override
    public synchronized int read(byte[] buf, int off, int len)
                                 throws IOException {
  
      //for the first read, skip the extra bytes at the front.
      if (lastChunkLen < 0 && startOffset > firstChunkOffset) {
        // Skip these bytes. But don't call this.skip()!
        int toSkip = (int)(startOffset - firstChunkOffset);
        if ( skipBuf == null ) {
          skipBuf = new byte[bytesPerChecksum];
        }
        if ( super.read(skipBuf, 0, toSkip) != toSkip ) {
          // should never happen
          throw new IOException("Could not skip required number of bytes");
        }
        updateStatsAfterRead(toSkip);
      }
  
      boolean eosBefore = eos;
      int nRead = super.read(buf, off, len);
      
      // if gotEOS was set in the previous read, send a status code to the DN:
      if (dnSock != null && eos && !eosBefore && nRead >= 0) {
        if (needChecksum()) {
          sendReadResult(dnSock, DataTransferProtocol.OP_STATUS_CHECKSUM_OK);
        } else {
          sendReadResult(dnSock, DataTransferProtocol.OP_STATUS_SUCCESS);
        }
      }
      updateStatsAfterRead(nRead);
      return nRead;
    }
docs: /* same interface as inputStream java.io.InputStream#read()
  used by DFSInputStream#read()
  This violates one rule when there is a checksum error:
  "Read should not modify user buffer before successful read"
  because it first reads the data to user buffer and then checks
  the checksum.