Piece

data class Piece(val piece: Int, val begin: Int, val block: ByteArray) : PeerMessage

piece (id 7): a block of data, block bytes at begin within piece. On the wire: [len][7][int32 piece][int32 begin][raw block], len = block.size + 9.

Constructors

Link copied to clipboard
constructor(piece: Int, begin: Int, block: ByteArray)

Properties

Link copied to clipboard
val begin: Int
Link copied to clipboard
Link copied to clipboard
open override val id: Int

The numeric message id, or -1 for KeepAlive (which has no id byte on the wire). Matches bt_peer_connection::message_type.

Link copied to clipboard
val piece: Int

Functions

Link copied to clipboard
open override fun encode(): ByteArray

The full on-the-wire frame: 4-byte big-endian length prefix + id + payload.

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 toString(): String