public class PeerBitfield extends Bitfield
bitmask, lock, piecesTotal
Constructor and Description |
---|
PeerBitfield(byte[] value,
BitOrder bitOrder,
int piecesTotal)
Creates bitfield based on a bitmask.
|
PeerBitfield(int piecesTotal)
Create an empty bitfield for a peer
|
Modifier and Type | Method and Description |
---|---|
void |
forEachVerifiedPiece(IntConsumer consumer) |
boolean |
markPeerPieceVerified(int pieceIndex)
Mark piece as complete and verified.
|
checkAndMarkVerified, getBitmask, getPiecesComplete, getPiecesIncomplete, getPiecesTotal, isComplete, isPieceVerified, isVerified, markVerified, toByteArray, validatePieceIndex
public PeerBitfield(int piecesTotal)
piecesTotal
- the total number of pieces in torrentpublic PeerBitfield(byte[] value, BitOrder bitOrder, int piecesTotal)
value
- Bitmask that describes status of all pieces.
If position i is set to 1, then piece with index i is complete and verified.piecesTotal
- Total number of pieces in torrent.public boolean markPeerPieceVerified(int pieceIndex)
pieceIndex
- Piece index (0-based)DataDescriptor.getChunkDescriptors()
public void forEachVerifiedPiece(IntConsumer consumer)
Copyright © 2016–2021. All rights reserved.