ReadPieceAlert

data class ReadPieceAlert(val torrentName: String?, val pieceIndex: Int, val buffer: ByteArray? = null, val size: Int = 0, val errorMessage: String? = null) : TorrentAlert

Posted in response to read_piece() once the asynchronous read completes. Ported from libtorrent::read_piece_alert (alert_type 5). Non-discardable.

On success buffer holds the full piece payload and errorMessage is null; on failure the torrent is paused, buffer is null and errorMessage describes what went wrong. libtorrent renders <name>: read_piece <piece> successful or <name>: read_piece <piece> failed: <error>.

Constructors

Link copied to clipboard
constructor(torrentName: String?, pieceIndex: Int, buffer: ByteArray? = null, size: Int = 0, errorMessage: String? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

the piece data on success, or null on failure.

Link copied to clipboard
open override val category: Int

The bitmask of AlertCategory flags this alert belongs to. Mirrors alert::category(), which returns the concrete alert's static_category.

Link copied to clipboard

the failure description, or null on success.

Link copied to clipboard

the index of the piece that was read.

Link copied to clipboard
val size: Int

the number of bytes read (the piece size on success).

Link copied to clipboard
open override val torrentName: String?

the torrent's name, or null when the handle would be invalid (rendered as " - ", matching libtorrent).

Link copied to clipboard
open override val type: Int

An integer unique to this alert type, matching the C++ alert_type static constant. It can be compared against a concrete alert's ALERT_TYPE to determine the runtime type. Mirrors alert::type().

Link copied to clipboard
open override val what: String

A short string literal naming the alert type (e.g. "torrent_finished"). It carries no bundled information. Mirrors alert::what(), which in libtorrent returns alert_name(alert_type).

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun message(): String

A string describing the alert and the information bundled with it. Intended for debugging/development, not localization. Mirrors alert::message().