java.lang.Object
org.klomp.snark.web.Sorters.FileAndIndex
Enclosing class:
Sorters

public static class Sorters.FileAndIndexextends Object
Class to precompute and efficiently sort data on a torrent file entry.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final File
    The file or directory this entry describes.
    final int
    Index of the file in storage, or -1 when it was not found.
    final boolean
    True if the entry is a directory rather than a file held in storage.
    final long
    Size in bytes, or 0 for a directory.
    final long
    Bytes of the file already in the preview, or 0 when none was computed.
    final int
    Storage priority of the file, or -999 to sort an unstored entry last.
    final long
    Bytes still needed for this file, or -1 when it is not in storage.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FileAndIndex(File file, Storage storage, long[] remainingArray)
    Create a file/index entry.
    FileAndIndex(File file, Storage storage, long[] remainingArray, long[] previewArray)
    Create a file/index entry with preview lengths.
  • Method Summary

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • file

      public final File file
      The file or directory this entry describes.
    • isDirectory

      public final boolean isDirectory
      True if the entry is a directory rather than a file held in storage.
    • length

      public final long length
      Size in bytes, or 0 for a directory.
    • remaining

      public final long remaining
      Bytes still needed for this file, or -1 when it is not in storage.
    • preview

      public final long preview
      Bytes of the file already in the preview, or 0 when none was computed.
    • priority

      public final int priority
      Storage priority of the file, or -999 to sort an unstored entry last.
    • index

      public final int index
      Index of the file in storage, or -1 when it was not found.
  • Constructor Details

    • FileAndIndex

      public FileAndIndex(File file, Storage storage, long[] remainingArray)
      Create a file/index entry.
      Parameters:
      file - the file or directory the entry describes
      storage - may be null
      remainingArray - precomputed, non-null iff storage is non-null
    • FileAndIndex

      public FileAndIndex(File file, Storage storage, long[] remainingArray, long[] previewArray)
      Create a file/index entry with preview lengths.
      Parameters:
      file - the file or directory the entry describes
      storage - may be null
      remainingArray - precomputed, non-null iff storage is non-null
      previewArray - precomputed preview lengths indexed the same way, or null when no previews have been computed