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 Summary

    Constructors
    Constructor
    Description
    PieceIndexBitfield(com.frostwire.jlibtorrent.swig.bitfield f)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Make the bitfield empty, of zero size.
    void
    Set all bits in the bitfield to 1 (set_all) or 0 (clear_all).
    void
    clearBit(int index)
     
    int
    Counts the number of bits in the bitfield that are set to 1.
    int
     
    int
     
    boolean
    getBit(int index)
     
    boolean
    Returns true if all bits in the bitfield are set.
    boolean
    Returns true if the bitfield has zero size.
    boolean
     
    void
    resize(int bits)
     
    void
    resize(int bits, boolean val)
    Set the size of the bitfield to ``bits`` length.
    void
    Set all bits in the bitfield to 1 (set_all) or 0 (clear_all).
    void
    setBit(int index)
     
    int
    Returns the size of the bitfield in bits.
    com.frostwire.jlibtorrent.swig.bitfield
     
    com.frostwire.jlibtorrent.swig.torrent_status
    ts()
    This methods returns the internal torrent status or null if it was constructed without one.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PieceIndexBitfield

      public PieceIndexBitfield(com.frostwire.jlibtorrent.swig.bitfield f)
      Parameters:
      f - the native object
  • Method Details

    • swig

      public com.frostwire.jlibtorrent.swig.bitfield swig()
      Returns:
      the native object
    • ts

      public com.frostwire.jlibtorrent.swig.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.