Class ReadPieceAlert

All Implemented Interfaces:
Alert<read_piece_alert>

public final class ReadPieceAlert extends TorrentAlert<read_piece_alert>
This alert is posted when the asynchronous read operation initiated by a call to TorrentHandle.readPiece(int) is completed. If the read failed, the torrent is paused and an error state is set and the buffer member of the alert is 0. If successful, bufferPtr() points to a buffer containing all the data of the piece. piece() is the piece index that was read. size() is the number of bytes that was read.

If the operation fails, error() will indicate what went wrong.

  • Method Details

    • error

      public ErrorCode error()
      Returns:
      the error
    • bufferPtr

      public long bufferPtr()
      Returns:
      the native buffer pointer
    • piece

      public int piece()
      Returns:
      the piece index
    • size

      public int size()
      Returns:
      the piece size