Class FMFileAccessCompact
- java.lang.Object
-
- com.biglybt.core.diskmanager.file.impl.FMFileAccessCompact
-
- All Implemented Interfaces:
FMFileAccess
public class FMFileAccessCompact extends java.lang.Object implements FMFileAccess
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.biglybt.core.diskmanager.file.impl.FMFileAccess
FMFileAccess.FileAccessor
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
controlFileDir
private java.lang.String
controlFileName
private long
current_length
private FMFileAccess
delegate
private long
first_piece_length
private long
first_piece_start
private long
last_piece_length
private long
last_piece_start
private static byte
SS
private static long
version
private boolean
write_required
-
Constructor Summary
Constructors Modifier Constructor Description protected
FMFileAccessCompact(TOTorrentFile torrent_file, java.io.File _controlFileDir, java.lang.String _controlFileName, FMFileAccess _delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
aboutToOpen()
void
flush()
FMFileImpl
getFile()
protected long
getFirstPieceLength()
protected long
getFirstPieceStart()
protected long
getLastPieceLength()
protected long
getLastPieceStart()
long
getLength(FMFileAccess.FileAccessor fa)
java.lang.String
getString()
boolean
isPieceCompleteProcessingNeeded(int piece_number)
void
read(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position)
protected void
read(FMFileAccess.FileAccessor fa, DirectByteBuffer buffer, long position)
protected void
readState()
void
setLength(FMFileAccess.FileAccessor fa, long length)
void
setPieceComplete(FMFileAccess.FileAccessor fa, int piece_number, DirectByteBuffer piece_data)
void
write(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position)
protected void
write(FMFileAccess.FileAccessor fa, DirectByteBuffer buffer, long position)
protected void
writeState()
-
-
-
Field Detail
-
SS
private static final byte SS
- See Also:
- Constant Field Values
-
controlFileDir
private final java.io.File controlFileDir
-
controlFileName
private final java.lang.String controlFileName
-
delegate
private final FMFileAccess delegate
-
current_length
private volatile long current_length
-
version
private static final long version
- See Also:
- Constant Field Values
-
write_required
private volatile boolean write_required
-
first_piece_start
private long first_piece_start
-
first_piece_length
private long first_piece_length
-
last_piece_start
private long last_piece_start
-
last_piece_length
private long last_piece_length
-
-
Constructor Detail
-
FMFileAccessCompact
protected FMFileAccessCompact(TOTorrentFile torrent_file, java.io.File _controlFileDir, java.lang.String _controlFileName, FMFileAccess _delegate) throws FMFileManagerException
- Throws:
FMFileManagerException
-
-
Method Detail
-
getFirstPieceStart
protected long getFirstPieceStart()
-
getFirstPieceLength
protected long getFirstPieceLength()
-
getLastPieceStart
protected long getLastPieceStart()
-
getLastPieceLength
protected long getLastPieceLength()
-
aboutToOpen
public void aboutToOpen() throws FMFileManagerException
- Specified by:
aboutToOpen
in interfaceFMFileAccess
- Throws:
FMFileManagerException
-
getLength
public long getLength(FMFileAccess.FileAccessor fa) throws FMFileManagerException
- Specified by:
getLength
in interfaceFMFileAccess
- Throws:
FMFileManagerException
-
setLength
public void setLength(FMFileAccess.FileAccessor fa, long length) throws FMFileManagerException
- Specified by:
setLength
in interfaceFMFileAccess
- Throws:
FMFileManagerException
-
read
protected void read(FMFileAccess.FileAccessor fa, DirectByteBuffer buffer, long position) throws FMFileManagerException
- Throws:
FMFileManagerException
-
read
public void read(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position) throws FMFileManagerException
- Specified by:
read
in interfaceFMFileAccess
- Throws:
FMFileManagerException
-
write
protected void write(FMFileAccess.FileAccessor fa, DirectByteBuffer buffer, long position) throws FMFileManagerException
- Throws:
FMFileManagerException
-
write
public void write(FMFileAccess.FileAccessor fa, DirectByteBuffer[] buffers, long position) throws FMFileManagerException
- Specified by:
write
in interfaceFMFileAccess
- Throws:
FMFileManagerException
-
flush
public void flush() throws FMFileManagerException
- Specified by:
flush
in interfaceFMFileAccess
- Throws:
FMFileManagerException
-
isPieceCompleteProcessingNeeded
public boolean isPieceCompleteProcessingNeeded(int piece_number)
- Specified by:
isPieceCompleteProcessingNeeded
in interfaceFMFileAccess
-
setPieceComplete
public void setPieceComplete(FMFileAccess.FileAccessor fa, int piece_number, DirectByteBuffer piece_data) throws FMFileManagerException
- Specified by:
setPieceComplete
in interfaceFMFileAccess
- Throws:
FMFileManagerException
-
readState
protected void readState() throws FMFileManagerException
- Throws:
FMFileManagerException
-
writeState
protected void writeState() throws FMFileManagerException
- Throws:
FMFileManagerException
-
getFile
public FMFileImpl getFile()
- Specified by:
getFile
in interfaceFMFileAccess
-
getString
public java.lang.String getString()
- Specified by:
getString
in interfaceFMFileAccess
-
-