|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.processmining.framework.log.rfb.io.VirtualFileSystem
public class VirtualFileSystem
This class implements a virtual file system, from which new files, as random access storage containers, can be obtained. These files are only possible to grow, i.e. cannot be compacted other than copying them to a newly allocated file.
The virtual file system creates and manages blocks and their size dynamically, however during the runtime of the virtual machine the amount of memory used by the virtual file system does not decrease, i.e. there is no garbage collection.
Virtual file systems are usually used as singleton, as the file system itself is an abstraction and does not group logical entities of a specific class. However, if you intend to use several, separated virtual file systems, adequate constructors are provided.
The virtual file system makes a best effort, to delete the backing swap files from disk at the moment of garbage collection or, again, at virtual machine shutdown.
Nested Class Summary | |
---|---|
protected static class |
VirtualFileSystem.ShutdownHook
This class implements a shutdown hook, which will clear all swap files from the file system at the moment, at which the JVM shuts down. |
Field Summary | |
---|---|
static int |
DEFAULT_SWAP_FILE_SIZE
32 Megabytes default swap file size |
protected static VirtualFileSystem |
instance
Singleton instance |
static java.lang.String |
SWAP_PREFIX
Default prefix for swap files |
static java.lang.String |
SWAP_SUFFIX
Default suffix for swap files |
protected java.io.File |
swapDir
Location where to keep swap files. |
protected java.util.ArrayList<BlockDataStorage> |
swapFiles
List of allocated swap files. |
protected int |
swapFileSize
Size of a swap file. |
Constructor Summary | |
---|---|
VirtualFileSystem()
Creates a new virtual file system with default settings. |
|
VirtualFileSystem(int aSwapFileSize,
java.io.File aSwapDirectory)
Creates a customized instance of a virtual file system. |
Method Summary | |
---|---|
StorageBlock |
allocateBlock(int minSize)
Allocates a new block from the first free swap file. |
RandomAccessStorage |
createStorage()
Creates a new empty random access storage, which is suitable for storing byte sequences and primitive data types. |
protected void |
finalize()
Remove swap files when this instance is garbage collected. |
BlockDataStorageInfo[] |
getSwapFileInfos()
Returns an array of information containers about each swap file currently used by this virtual file system |
BlockDataStorage[] |
getSwapFiles()
Returns an array of current swap files used by this virtual file system |
static VirtualFileSystem |
instance()
Singleton access method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_SWAP_FILE_SIZE
public static final java.lang.String SWAP_PREFIX
public static final java.lang.String SWAP_SUFFIX
protected static VirtualFileSystem instance
protected int swapFileSize
protected java.io.File swapDir
protected java.util.ArrayList<BlockDataStorage> swapFiles
Constructor Detail |
---|
public VirtualFileSystem()
public VirtualFileSystem(int aSwapFileSize, java.io.File aSwapDirectory)
aSwapFileSize
- Size of individual swap files in bytes.aSwapDirectory
- Directory where to create and keep the
swap files.Method Detail |
---|
public static VirtualFileSystem instance()
public RandomAccessStorage createStorage()
StorageProvider
createStorage
in interface StorageProvider
public BlockDataStorage[] getSwapFiles()
public BlockDataStorageInfo[] getSwapFileInfos()
public StorageBlock allocateBlock(int minSize) throws java.io.IOException
This method is for use by file metaphors using the virtual file system as storage implementation. It is not intended to allocate blocks, if you intend to use them at a higher level of abstraction (byte buffers, files,...)
minSize
- The minimum size of the returned storage block.
Can be 0
or negative, in this case the size of the
returned block is not checked.
java.io.IOException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |