Class PieceIndexBitfield

java.lang.Object
com.frostwire.jlibtorrent.PieceIndexBitfield

public final class PieceIndexBitfield extends Object
The bitfield type stores any number of bits as a bitfield in a heap allocated array.
  • Constructor Details

    • PieceIndexBitfield

      public PieceIndexBitfield(bitfield f)
      Parameters:
      f - the native object
  • Method Details

    • swig

      public bitfield swig()
      Returns:
      the native object
    • ts

      public torrent_status 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 bits
      val - 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.