Class FMFileImpl
- java.lang.Object
-
- com.biglybt.core.diskmanager.file.impl.FMFileImpl
-
- All Implemented Interfaces:
FMFile
- Direct Known Subclasses:
FMFileLimited
,FMFileUnlimited
public abstract class FMFileImpl extends java.lang.Object implements FMFile
-
-
Field Summary
Fields Modifier and Type Field Description private int
access_mode
private java.lang.String
canonical_path
private boolean
clone
private java.util.List
created_dirs
private java.io.File
created_dirs_leaf
private FMFileAccess.FileAccessor
fa
private FMFileAccessController
file_access
private static java.util.Map
file_map
private static AEMonitor
file_map_mon
private long
last_modified
private long
length_cache
private java.io.File
linked_file
private FMFileManagerImpl
manager
private static boolean
OUTPUT_REOPEN_RELATED_ERRORS
private FMFileOwner
owner
protected static java.lang.String
READ_ACCESS_MODE
protected AEMonitor
this_mon
protected static java.lang.String
WRITE_ACCESS_MODE
-
Fields inherited from interface com.biglybt.core.diskmanager.file.FMFile
FM_READ, FM_WRITE, FT_COMPACT, FT_LINEAR, FT_PIECE_REORDER, FT_PIECE_REORDER_COMPACT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FMFileImpl(FMFileOwner _owner, FMFileManagerImpl _manager, java.io.File _file, int _type, boolean _force)
protected
FMFileImpl(FMFileImpl basis)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeSupport(boolean explicit)
protected void
createDirs(java.io.File target)
void
delete()
protected void
deleteDirs()
void
ensureOpen(java.lang.String reason)
boolean
exists()
void
flush()
protected static void
generateEvidence(IndentWriter writer)
int
getAccessMode()
long
getLastModified()
protected long
getLengthCache()
protected long
getLengthSupport()
protected java.io.File
getLinkedFile()
protected FMFileManagerImpl
getManager()
java.lang.String
getName()
FMFileOwner
getOwner()
int
getStorageType()
protected java.lang.String
getString()
boolean
isClone()
boolean
isOpen()
protected boolean
isPieceCompleteProcessingNeeded(int piece_number)
void
moveFile(java.io.File new_unlinked_file, FileUtil.ProgressListener pl)
protected void
openSupport(java.lang.String reason)
protected void
readSupport(DirectByteBuffer[] buffers, long position)
protected void
readSupport(DirectByteBuffer buffer, long position)
private void
releaseFile()
void
renameFile(java.lang.String new_name)
protected void
reopen(FMFileManagerException cause)
private void
reserveAccess(java.lang.String reason)
private void
reserveFile()
protected void
setAccessModeSupport(int mode)
protected void
setLengthSupport(long length)
protected void
setPieceCompleteSupport(int piece_number, DirectByteBuffer piece_data)
void
setStorageType(int new_type, boolean force)
protected void
writeSupport(DirectByteBuffer[] buffers, long position)
protected void
writeSupport(DirectByteBuffer buffer, long position)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.biglybt.core.diskmanager.file.FMFile
close, createClone, getLength, read, read, setAccessMode, setLength, setPieceComplete, write, write
-
-
-
-
Field Detail
-
READ_ACCESS_MODE
protected static final java.lang.String READ_ACCESS_MODE
- See Also:
- Constant Field Values
-
WRITE_ACCESS_MODE
protected static final java.lang.String WRITE_ACCESS_MODE
- See Also:
- Constant Field Values
-
file_map
private static final java.util.Map file_map
-
file_map_mon
private static final AEMonitor file_map_mon
-
OUTPUT_REOPEN_RELATED_ERRORS
private static final boolean OUTPUT_REOPEN_RELATED_ERRORS
- See Also:
- Constant Field Values
-
manager
private final FMFileManagerImpl manager
-
owner
private final FMFileOwner owner
-
access_mode
private int access_mode
-
linked_file
private java.io.File linked_file
-
last_modified
private long last_modified
-
canonical_path
private java.lang.String canonical_path
-
fa
private FMFileAccess.FileAccessor fa
-
file_access
private FMFileAccessController file_access
-
created_dirs_leaf
private java.io.File created_dirs_leaf
-
created_dirs
private java.util.List created_dirs
-
this_mon
protected final AEMonitor this_mon
-
length_cache
private volatile long length_cache
-
clone
private boolean clone
-
-
Constructor Detail
-
FMFileImpl
protected FMFileImpl(FMFileOwner _owner, FMFileManagerImpl _manager, java.io.File _file, int _type, boolean _force) throws FMFileManagerException
- Throws:
FMFileManagerException
-
FMFileImpl
protected FMFileImpl(FMFileImpl basis) throws FMFileManagerException
- Throws:
FMFileManagerException
-
-
Method Detail
-
getManager
protected FMFileManagerImpl getManager()
-
getOwner
public FMFileOwner getOwner()
-
setStorageType
public void setStorageType(int new_type, boolean force) throws FMFileManagerException
- Specified by:
setStorageType
in interfaceFMFile
- Throws:
FMFileManagerException
-
getStorageType
public int getStorageType()
- Specified by:
getStorageType
in interfaceFMFile
-
getAccessMode
public int getAccessMode()
- Specified by:
getAccessMode
in interfaceFMFile
-
setAccessModeSupport
protected void setAccessModeSupport(int mode)
-
getLinkedFile
protected java.io.File getLinkedFile()
-
moveFile
public void moveFile(java.io.File new_unlinked_file, FileUtil.ProgressListener pl) throws FMFileManagerException
- Specified by:
moveFile
in interfaceFMFile
- Throws:
FMFileManagerException
-
renameFile
public void renameFile(java.lang.String new_name) throws FMFileManagerException
- Specified by:
renameFile
in interfaceFMFile
- Throws:
FMFileManagerException
-
ensureOpen
public void ensureOpen(java.lang.String reason) throws FMFileManagerException
- Specified by:
ensureOpen
in interfaceFMFile
- Throws:
FMFileManagerException
-
getLengthCache
protected long getLengthCache()
-
getLengthSupport
protected long getLengthSupport() throws FMFileManagerException
- Throws:
FMFileManagerException
-
setLengthSupport
protected void setLengthSupport(long length) throws FMFileManagerException
- Throws:
FMFileManagerException
-
reopen
protected void reopen(FMFileManagerException cause) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
openSupport
protected void openSupport(java.lang.String reason) throws FMFileManagerException
- Throws:
FMFileManagerException
-
closeSupport
protected void closeSupport(boolean explicit) throws FMFileManagerException
- Throws:
FMFileManagerException
-
flush
public void flush() throws FMFileManagerException
- Specified by:
flush
in interfaceFMFile
- Throws:
FMFileManagerException
-
isPieceCompleteProcessingNeeded
protected boolean isPieceCompleteProcessingNeeded(int piece_number) throws FMFileManagerException
- Throws:
FMFileManagerException
-
setPieceCompleteSupport
protected void setPieceCompleteSupport(int piece_number, DirectByteBuffer piece_data) throws FMFileManagerException
- Throws:
FMFileManagerException
-
delete
public void delete() throws FMFileManagerException
- Specified by:
delete
in interfaceFMFile
- Throws:
FMFileManagerException
-
readSupport
protected void readSupport(DirectByteBuffer buffer, long position) throws FMFileManagerException
- Throws:
FMFileManagerException
-
readSupport
protected void readSupport(DirectByteBuffer[] buffers, long position) throws FMFileManagerException
- Throws:
FMFileManagerException
-
writeSupport
protected void writeSupport(DirectByteBuffer buffer, long position) throws FMFileManagerException
- Throws:
FMFileManagerException
-
writeSupport
protected void writeSupport(DirectByteBuffer[] buffers, long position) throws FMFileManagerException
- Throws:
FMFileManagerException
-
getLastModified
public long getLastModified()
- Specified by:
getLastModified
in interfaceFMFile
-
reserveFile
private void reserveFile() throws FMFileManagerException
- Throws:
FMFileManagerException
-
reserveAccess
private void reserveAccess(java.lang.String reason) throws FMFileManagerException
- Throws:
FMFileManagerException
-
releaseFile
private void releaseFile()
-
createDirs
protected void createDirs(java.io.File target) throws FMFileManagerException
- Throws:
FMFileManagerException
-
deleteDirs
protected void deleteDirs()
-
getString
protected java.lang.String getString()
-
generateEvidence
protected static void generateEvidence(IndentWriter writer)
-
-