code: @Override
    public int read(byte []buf, int offset, int length) throws IOException
    {
      try {
        SocketChannel s = _s;
        
        if (s == null) {
          return -1;
        }
        
        int remaining = _readBuffer.remaining();
        if (remaining <= 0) {
          _readBuffer.clear();
          
          if (s.read(_readBuffer) < 0) {
            _readBuffer.flip();
            return -1;
          }
          
          _readBuffer.flip();
          
          remaining = _readBuffer.remaining();
        }
        
        int sublen = Math.min(remaining, length); 
  
        _readBuffer.get(buf, offset, sublen);
        
        int readLength = sublen;
  
        if (readLength >= 0) {
          _totalReadBytes += readLength;
        }
  
        return readLength;
      } catch (InterruptedIOException e) {
        if (_throwReadInterrupts)
          throw e;
        
        log.log(Level.FINEST, e.toString(), e);
      } catch (IOException e) {
        if (_throwReadInterrupts) {
          throw e;
        }
  
        if (log.isLoggable(Level.FINEST)) {
          log.log(Level.FINEST, e.toString(), e);
        }
        else {
          log.finer(e.toString());
        }
        // server/0611
        /*
        try {
          close();
        } catch (IOException e1) {
        }
        */
      }
  
      return -1;
    }
docs: Reads bytes from the socket.
  
  @param buf byte buffer receiving the bytes
  @param offset offset into the buffer
  @param length number of bytes to read
  @return number of bytes read or -1
  @exception throws ClientDisconnectException if the connection is dropped