Class FileSlice

java.lang.Object
com.frostwire.jlibtorrent.FileSlice

public final class FileSlice extends Object
Represents a window of a file in a torrent.

The fileIndex() refers to the index of the file (in the TorrentInfo). To get the path and filename, use TorrentInfo.files(). The offset() is the byte offset in the file where the range starts, and size() is the number of bytes this range is. The size + offset will never be greater than the file size.

Implementation note: This class does not store internally a reference to the native swig file_slice. This is because we are dealing with only three integral values and we want to avoid keeping a reference to a memory in the native heap.

  • Constructor Details

    • FileSlice

      public FileSlice(file_slice fs)
      Parameters:
      fs - the native object
  • Method Details

    • fileIndex

      public int fileIndex()
      The index of the file.
      Returns:
      the index
    • offset

      public long offset()
      The offset from the start of the file, in bytes.
      Returns:
      the offset
    • size

      public long size()
      The size of the window, in bytes.
      Returns:
      the size
    • toString

      public String toString()
      Overrides:
      toString in class Object