java.lang.Object
org.klomp.snark.web.Sorters.FileAndIndex
- Enclosing class:
Sorters
Class to precompute and efficiently sort data on a torrent file entry.
Field Summary
FieldsModifier and TypeFieldDescriptionfinal FileThe file or directory this entry describes.final intIndex of the file in storage, or -1 when it was not found.final booleanTrue if the entry is a directory rather than a file held in storage.final longSize in bytes, or 0 for a directory.final longBytes of the file already in the preview, or 0 when none was computed.final intStorage priority of the file, or -999 to sort an unstored entry last.final longBytes still needed for this file, or -1 when it is not in storage.Constructor Summary
ConstructorsConstructorDescriptionFileAndIndex(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
Field Details
file
The file or directory this entry describes.isDirectory
public final boolean isDirectoryTrue if the entry is a directory rather than a file held in storage.length
public final long lengthSize in bytes, or 0 for a directory.remaining
public final long remainingBytes still needed for this file, or -1 when it is not in storage.preview
public final long previewBytes of the file already in the preview, or 0 when none was computed.priority
public final int priorityStorage priority of the file, or -999 to sort an unstored entry last.index
public final int indexIndex of the file in storage, or -1 when it was not found.
Constructor Details
FileAndIndex
FileAndIndex
Create a file/index entry with preview lengths.- Parameters:
file- the file or directory the entry describesstorage- may be nullremainingArray- precomputed, non-null iff storage is non-nullpreviewArray- precomputed preview lengths indexed the same way, or null when no previews have been computed