Class PieceIndexBitfield
java.lang.Object
com.frostwire.jlibtorrent.PieceIndexBitfield
The bitfield type stores any number of bits as a bitfield
in a heap allocated array.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Make the bitfield empty, of zero size.voidclearAll()Set all bits in the bitfield to 1 (set_all) or 0 (clear_all).voidclearBit(int index) intcount()Counts the number of bits in the bitfield that are set to 1.intintbooleangetBit(int index) booleanisAllSet()Returns true if all bits in the bitfield are set.booleanisEmpty()Returns true if the bitfield has zero size.booleanvoidresize(int bits) voidresize(int bits, boolean val) Set the size of the bitfield to ``bits`` length.voidsetAll()Set all bits in the bitfield to 1 (set_all) or 0 (clear_all).voidsetBit(int index) intsize()Returns the size of the bitfield in bits.swig()ts()This methods returns the internal torrent status or null if it was constructed without one.
-
Constructor Details
-
PieceIndexBitfield
- Parameters:
f- the native object
-
-
Method Details
-
swig
- Returns:
- the native object
-
ts
This methods returns the internal torrent status or null if it was constructed without one.This also prevent premature garbage collection in case the storage was created from a torrent status.
- Returns:
- the pinned torrent info
-
getBit
public boolean getBit(int index) - Parameters:
index- the bit index- Returns:
- the bit value
-
clearBit
public void clearBit(int index) - Parameters:
index- the bit index
-
setBit
public void setBit(int index) - Parameters:
index- the bit index
-
isAllSet
public boolean isAllSet()Returns true if all bits in the bitfield are set.- Returns:
- true if all bits are set
-
isNoneSet
public boolean isNoneSet()- Returns:
- true if no bit is set
-
size
public int size()Returns the size of the bitfield in bits.- Returns:
- the size
-
isEmpty
public boolean isEmpty()Returns true if the bitfield has zero size.- Returns:
- true if empty
-
count
public int count()Counts the number of bits in the bitfield that are set to 1.- Returns:
- the number of bits set
-
findFirstSet
public int findFirstSet()- Returns:
- the bit index
-
findLastClear
public int findLastClear()- Returns:
- the bit index
-
resize
public void resize(int bits, boolean val) Set the size of the bitfield to ``bits`` length. If the bitfield is extended, the new bits are initialized to ``val``.- Parameters:
bits- the number of bitsval- the bits value
-
resize
public void resize(int bits) - Parameters:
bits- the number of bits
-
setAll
public void setAll()Set all bits in the bitfield to 1 (set_all) or 0 (clear_all). -
clearAll
public void clearAll()Set all bits in the bitfield to 1 (set_all) or 0 (clear_all). -
clear
public void clear()Make the bitfield empty, of zero size.
-