Class RamFileSystem
java.lang.Object
org.apache.commons.vfs2.provider.AbstractVfsComponent
org.apache.commons.vfs2.provider.AbstractFileSystem
org.apache.commons.vfs2.provider.ram.RamFileSystem
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,FileSystem
,VfsComponent
A RAM File System.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<FileName, RamFileData> Cache of RAM File Dataprivate static final long
serialVersionUID format is YYYYMMDD for the date of the last binary change. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
RamFileSystem
(FileName rootName, FileSystemOptions fileSystemOptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCapabilities
(Collection<Capability> caps) Adds the capabilities of this file system.void
attach
(RamFileObject fo) void
close()
Close the RAMFileSystem.protected FileObject
createFile
(AbstractFileName name) Creates a file object.(package private) void
delete
(RamFileObject file) Delete a filevoid
importTree
(File file) Import a Tree.(package private) String[]
listChildren
(FileName name) (package private) void
rename
(RamFileObject from, RamFileObject to) (package private) void
save
(RamFileObject file) Saves a file(package private) long
size()
private void
toRamFileObject
(FileObject fo, FileObject root) Import the given file with the name relative to the given rootMethods inherited from class org.apache.commons.vfs2.provider.AbstractFileSystem
addJunction, addListener, closeCommunicationLink, decorateFileObject, doCloseCommunicationLink, doReplicateFile, fireFileChanged, fireFileCreated, fireFileDeleted, getAttribute, getFileFromCache, getFileSystemManager, getFileSystemOptions, getLastModTimeAccuracy, getParentLayer, getRoot, getRootName, getRootURI, hasCapability, init, isOpen, isReleaseable, notifyAllStreamsClosed, putFileToCache, removeFileFromCache, removeJunction, removeListener, replicateFile, resolveFile, resolveFile, setAttribute
Methods inherited from class org.apache.commons.vfs2.provider.AbstractVfsComponent
getContext, getLogger, setContext, setLogger
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDserialVersionUID format is YYYYMMDD for the date of the last binary change.- See Also:
-
cache
Cache of RAM File Data
-
-
Constructor Details
-
RamFileSystem
- Parameters:
rootName
- The root file name.fileSystemOptions
- The FileSystem options.
-
-
Method Details
-
createFile
Description copied from class:AbstractFileSystem
Creates a file object.This method is called only if the requested file is not cached.
- Specified by:
createFile
in classAbstractFileSystem
- Parameters:
name
- name referencing the new file.- Returns:
- new created FileObject.
- Throws:
Exception
- might throw an Exception, which is then wrapped in FileSystemException.
-
addCapabilities
Description copied from class:AbstractFileSystem
Adds the capabilities of this file system.- Specified by:
addCapabilities
in classAbstractFileSystem
- Parameters:
caps
- collections of Capabilities, can be immutable.
-
listChildren
- Parameters:
name
- The name of the file.- Returns:
- children The names of the children.
-
delete
Delete a file- Parameters:
file
- theRamFileObject
file to delete.- Throws:
FileSystemException
- Thrown for file system errors.
-
save
Saves a file- Parameters:
file
- theRamFileObject
file to save.- Throws:
FileSystemException
- Thrown for file system errors.
-
rename
- Parameters:
from
- The original file.to
- The new file.- Throws:
FileSystemException
- if an error occurs.
-
attach
-
importTree
Import a Tree.- Parameters:
file
- The File- Throws:
FileSystemException
- if an error occurs.
-
toRamFileObject
Import the given file with the name relative to the given root- Parameters:
fo
- the sourceFileObject
file to import.root
- theFileObject
root.- Throws:
FileSystemException
- Thrown for file system errors.
-
size
long size()- Returns:
- Returns the size of the FileSystem
-
close
public void close()Close the RAMFileSystem.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceVfsComponent
- Overrides:
close
in classAbstractFileSystem
-