Class FMFileAccessPieceReorderer
java.lang.Object
com.biglybt.core.diskmanager.file.impl.FMFileAccessPieceReorderer
- All Implemented Interfaces:
FMFileAccess
-
Nested Class Summary
Nested classes/interfaces inherited from interface FMFileAccess
FMFileAccess.FileAccessor -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Fileprivate final Stringprivate longprivate final FMFileAccessprivate static final intprivate static final intprivate static final longprivate static final intprivate intprivate longprivate intprivate intprivate intprivate static final intprivate intprivate intprivate int[]private int[]private intprivate intprivate static final byteprivate final intprivate static final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFMFileAccessPieceReorderer(TOTorrentFile _torrent_file, File _control_dir, String _control_file, int _storage_type, FMFileAccess _delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate voidconfigBorked(String error) private static MapencodeConfig(int storage_type, long current_length, long next_piece_index, int[] piece_map) voidflush()getFile()longprotected intgetPieceIndex(FMFileAccess.FileAccessor fa, int piece_number, boolean allocate_if_needed) protected longgetPieceOffset(FMFileAccess.FileAccessor fa, int piece_number, boolean allocate_if_needed) booleanisPieceCompleteProcessingNeeded(int piece_number) voidread(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position) private voidprotected voidreadWrite(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position, boolean is_read) protected intreadWritePiece(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, int piece_number, int piece_offset, boolean is_read) protected static voidrecoverConfig(TOTorrentFile torrent_file, File data_file, File config_file, int storage_type) protected voidsetDirty()voidsetLength(FMFileAccess.FileAccessor fa, long length) voidsetPieceComplete(FMFileAccess.FileAccessor fa, int piece_number, DirectByteBuffer piece_data) voidwrite(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position) private void
-
Field Details
-
TRACE
private static final boolean TRACE- See Also:
-
MIN_PIECES_REORDERABLE
private static final int MIN_PIECES_REORDERABLE- See Also:
-
SS_FILE
private static final byte SS_FILE- See Also:
-
DIRT_CLEAN
private static final int DIRT_CLEAN- See Also:
-
DIRT_DIRTY
private static final int DIRT_DIRTY- See Also:
-
DIRT_NEVER_WRITTEN
private static final int DIRT_NEVER_WRITTEN- See Also:
-
DIRT_FLUSH_MILLIS
private static final long DIRT_FLUSH_MILLIS- See Also:
-
delegate
-
control_dir
-
control_file
-
storage_type
private final int storage_type -
piece_size
private int piece_size -
first_piece_length
private int first_piece_length -
first_piece_number
private int first_piece_number -
last_piece_length
private int last_piece_length -
num_pieces
private int num_pieces -
previous_storage_type
private int previous_storage_type -
current_length
private long current_length -
piece_map
private int[] piece_map -
piece_reverse_map
private int[] piece_reverse_map -
next_piece_index
private int next_piece_index -
dirt_state
private int dirt_state -
dirt_time
private long dirt_time
-
-
Constructor Details
-
FMFileAccessPieceReorderer
protected FMFileAccessPieceReorderer(TOTorrentFile _torrent_file, File _control_dir, String _control_file, int _storage_type, FMFileAccess _delegate) throws FMFileManagerException - Throws:
FMFileManagerException
-
-
Method Details
-
aboutToOpen
- Specified by:
aboutToOpenin interfaceFMFileAccess- Throws:
FMFileManagerException
-
getLength
- Specified by:
getLengthin interfaceFMFileAccess- Throws:
FMFileManagerException
-
setLength
- Specified by:
setLengthin interfaceFMFileAccess- Throws:
FMFileManagerException
-
getPieceOffset
protected long getPieceOffset(FMFileAccess.FileAccessor fa, int piece_number, boolean allocate_if_needed) throws FMFileManagerException - Throws:
FMFileManagerException
-
readWritePiece
protected int readWritePiece(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, int piece_number, int piece_offset, boolean is_read) throws FMFileManagerException - Throws:
FMFileManagerException
-
readWrite
protected void readWrite(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position, boolean is_read) throws FMFileManagerException - Throws:
FMFileManagerException
-
read
public void read(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position) throws FMFileManagerException - Specified by:
readin interfaceFMFileAccess- Throws:
FMFileManagerException
-
write
public void write(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position) throws FMFileManagerException - Specified by:
writein interfaceFMFileAccess- Throws:
FMFileManagerException
-
flush
- Specified by:
flushin interfaceFMFileAccess- Throws:
FMFileManagerException
-
isPieceCompleteProcessingNeeded
public boolean isPieceCompleteProcessingNeeded(int piece_number) - Specified by:
isPieceCompleteProcessingNeededin interfaceFMFileAccess
-
setPieceComplete
public void setPieceComplete(FMFileAccess.FileAccessor fa, int piece_number, DirectByteBuffer piece_data) throws FMFileManagerException - Specified by:
setPieceCompletein interfaceFMFileAccess- Throws:
FMFileManagerException
-
getPieceIndex
protected int getPieceIndex(FMFileAccess.FileAccessor fa, int piece_number, boolean allocate_if_needed) throws FMFileManagerException - Throws:
FMFileManagerException
-
readConfig
- Throws:
FMFileManagerException
-
configBorked
- Throws:
FMFileManagerException
-
setDirty
- Throws:
FMFileManagerException
-
encodeConfig
private static Map encodeConfig(int storage_type, long current_length, long next_piece_index, int[] piece_map) -
recoverConfig
protected static void recoverConfig(TOTorrentFile torrent_file, File data_file, File config_file, int storage_type) throws FMFileManagerException - Throws:
FMFileManagerException
-
writeConfig
- Throws:
FMFileManagerException
-
getFile
- Specified by:
getFilein interfaceFMFileAccess
-
getString
- Specified by:
getStringin interfaceFMFileAccess
-