code: private ByteBuffer _read(long offset, long length, ByteBuffer buffer) throws IOException {
      if (offset + length > this.length) {
        throw new IllegalArgumentException("Piece#" + this.index +
                " overrun (" + offset + " + " + length + " > " +
                this.length + ") !");
      }
  
      // TODO: remove cast to int when large ByteBuffer support is
      // implemented in Java.
      int position = buffer.position();
      byte[] bytes = this.pieceStorage.readPiecePart(this.index, (int)offset, (int)length);
      buffer.put(bytes);
      buffer.rewind();
      buffer.limit(bytes.length + position);
      return buffer;
    }
docs: Internal piece data read function.
  
  <p>
  This function will read the piece data without checking if the piece has
  been validated. It is simply meant at factoring-in the common read code
  from the validate and read functions.
  </p>
  
  @param offset Offset inside this piece where to start reading.
  @param length Number of bytes to read from the piece.
  @return A byte buffer containing the piece data.
  @throws IllegalArgumentException If <em>offset + length</em> goes over
  the piece boundary.
  @throws IOException              If the read can't be completed (I/O error, or EOF
  reached, which can happen if the piece is not complete).