code: @Override
    public int read(byte []buffer, int offset, int length)
      throws IOException
    {
      try {
      if (_length < length)
        length = (int) _length;
  
      if (length <= 0)
        return -1;
  
      int len = _next.read(buffer, offset, length);
        
      if (len > 0) {
        _length -= len;
      }
      else {
        _length = -1;
      }
  
      return len;
      } catch (SocketTimeoutException e) {
        throw new ClientDisconnectException(e);
      }
    }
docs: Reads from the buffer, limiting to the content length.
  
  @param buffer the buffer containing the results.
  @param offset the offset into the result buffer
  @param length the length of the buffer.
  
  @return the number of bytes read or -1 for the end of the file.