public class MergeDirectlyFs extends FullFileSystem
| Constructor and Description |
|---|
MergeDirectlyFs(FileSystem master,
FileSystem slave)
Creates a new instance of MergeDirectlyFs.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterUnmounting()
Is called after the file system has been unmounted successfully.
|
void |
beforeMounting(java.lang.String mountPath)
Is called directly before the file system is mounted
|
void |
beforeUnmounting()
Is called directly before the file system is unmounted
|
void |
close(FileHandle handle)
Closes the file handle.
|
void |
createDirectory(java.lang.String path)
Creates a new, empty directory.
|
void |
createFile(java.lang.String path)
Creates a new (blank) file.
|
void |
createHardLink(java.lang.String source,
java.lang.String destination)
Creates a hard link at source pointing to destination.
|
void |
createSymbolicLink(java.lang.String source,
java.lang.String destination)
Creates a symbolic link at source pointing to destination.
|
void |
deleteDirectoryRecursively(java.lang.String directory)
Deletes a directory recursively.
|
void |
deleteFile(java.lang.String file)
Deletes a file or symbolic link.
|
void |
flush(FileHandle handle)
Should write all pending data in the cache.
|
int |
getBlockSize()
Returns the block size in bytes
|
EntityInfo |
getFileMetaData(java.lang.String path)
Returns some meta data about the path.
|
int |
getFilesFreeCount()
Returns the number of files which may be created.
|
java.lang.String |
getFileSystemName()
Returns the file system name
|
long |
getFreeBlockAvailableCount()
Returns the number of free blocks, which are available to the current user.
|
long |
getFreeBlockCount()
Returns the number of free blocks.
|
int |
getMaxPathLength()
Returns the maximum path length.
|
long |
getTotalBlockCount()
Returns the number of total blocks.
|
int |
getTotalFilesCount()
Returns the total number of files on the volume.
|
UnixPermissions |
getUnixPermissions(java.lang.String path)
Returns the unix permissions
|
java.lang.String |
getVolumeName()
Returns the volume name.
|
int |
getVolumeSerialNumber()
Returns a volume serial number
|
WindowsAttributes |
getWindowsAttributes(java.lang.String path)
Returns the windows attributes.
|
boolean |
isCaseSensitive()
Returns true if the pathes are case sensitive
|
boolean |
isCompressed()
Returns true if the file system is compressed
|
boolean |
isReadOnly()
Returns true if the file system is read only
|
java.lang.Iterable<EntityInfo> |
listDirectory(java.lang.String path)
Reads a given directory and returns an iterator.
|
java.lang.Iterable<ExtendedAttribute> |
listExtendedAttributes(java.lang.String path)
Lists the extended attributes of a path.
|
void |
lockFile(FileHandle handle,
long byteOffset,
long length)
Locks a file in the specified range for every write access except for the File Handle handle.
|
FileHandle |
openFile(java.lang.String file,
boolean read,
boolean write)
Opens a file.
|
int |
read(FileHandle handle,
java.nio.ByteBuffer buffer,
long offset)
Reads from a file.
|
void |
removeExtendedAttribute(java.lang.String path,
java.lang.String attributeName)
Sets or adds extended attributes.
|
void |
rename(java.lang.String source,
java.lang.String destination)
Renames a file/directory/symbolic link.
|
void |
setCreationTime(java.lang.String path,
long ctime)
Sets the creation time (unix timestamp).
|
void |
setExtendedAttribute(java.lang.String path,
ExtendedAttribute attribute)
Sets or adds extended attribute.
|
void |
setLastAccessTime(java.lang.String path,
long atime)
Sets the last access time (unix timestamp).
|
void |
setLastModificationTime(java.lang.String path,
long mtime)
Sets the last modification time (unix timestamp).
|
void |
setLength(FileHandle handle,
long length)
Truncates or lengthens a file.
|
void |
setUnixPermissions(java.lang.String path,
UnixPermissions perms)
Sets the unix permissions for a file/directory.
|
void |
setWindowsAttributes(java.lang.String path,
WindowsAttributes windowsAttributes)
Sets the windows attributes.
|
boolean |
supportsUnicodeFilenames()
Returns true if the file system supports unicode filenames.
|
void |
unlockFile(FileHandle handle,
long byteOffset,
long length)
Unlocks a file in the specified range.
|
void |
write(FileHandle handle,
java.nio.ByteBuffer buffer,
long offset)
(Over-)writes the buffer into the specified file handle.
|
delete, getExtendedAttribute, getMountPath, getNumberOfFilesInDirectory, pathExistspublic MergeDirectlyFs(FileSystem master, FileSystem slave)
master - the master file systemslave - the slave file systempublic void createSymbolicLink(java.lang.String source,
java.lang.String destination)
throws PathNotFoundException,
SourceAlreadyExistsException,
AccessDeniedException,
UnsupportedFeatureException
FileSystemcreateSymbolicLink in class FullFileSystemsource - the sourcedestination - the destinationPathNotFoundException - the parent directory (of source) could not be foundSourceAlreadyExistsException - the source does already existAccessDeniedException - the access was deniedUnsupportedFeatureException - the feature is unsupportedhttps://en.wikipedia.org/wiki/Symbolic_linkpublic void createHardLink(java.lang.String source,
java.lang.String destination)
throws PathNotFoundException,
SourceAlreadyExistsException,
AccessDeniedException,
UnsupportedFeatureException
FileSystemcreateHardLink in class FullFileSystemsource - the sourcedestination - the destinationPathNotFoundException - the parent directory could not be foundSourceAlreadyExistsException - the source does already existAccessDeniedException - the access was deniedUnsupportedFeatureException - the feature is unsupportedhttps://en.wikipedia.org/wiki/Hard_linkpublic int getMaxPathLength()
FileSystemgetMaxPathLength in class FullFileSystempublic int getFilesFreeCount()
FileSystemgetFilesFreeCount in class FullFileSystempublic int getTotalFilesCount()
FileSystemgetTotalFilesCount in class FullFileSystempublic void setUnixPermissions(java.lang.String path,
UnixPermissions perms)
throws PathNotFoundException,
AccessDeniedException,
UnsupportedFeatureException
FileSystemsetUnixPermissions in class FullFileSystempath - the pathperms - the permissionsPathNotFoundException - the path was not foundAccessDeniedException - the access is deniedUnsupportedFeatureException - the feature is unsupportedpublic UnixPermissions getUnixPermissions(java.lang.String path) throws PathNotFoundException
FileSystemgetUnixPermissions in class FullFileSystempath - the pathPathNotFoundException - the path was not foundpublic void setWindowsAttributes(java.lang.String path,
WindowsAttributes windowsAttributes)
throws PathNotFoundException,
AccessDeniedException,
UnsupportedFeatureException
FileSystemsetWindowsAttributes in class FullFileSystempath - the pathwindowsAttributes - the windows attributesPathNotFoundException - the path was not foundAccessDeniedException - the access is deniedUnsupportedFeatureException - the feature is not supportedpublic WindowsAttributes getWindowsAttributes(java.lang.String path) throws PathNotFoundException, AccessDeniedException, UnsupportedFeatureException
FileSystemgetWindowsAttributes in class FullFileSystempath - the pathPathNotFoundException - the path was not foundAccessDeniedException - the access is deniedUnsupportedFeatureException - the feature is not supportedpublic void lockFile(FileHandle handle, long byteOffset, long length) throws PathNotFoundException, AccessDeniedException, NotAFileException, UnsupportedFeatureException, AlreadyLockedException
FileSystemlockFile in class FullFileSystemhandle - the file handlebyteOffset - the byte offsetlength - the lengthPathNotFoundException - the path was not foundAccessDeniedException - the access is deniedNotAFileException - the path is not a fileUnsupportedFeatureException - the feature is not supportedAlreadyLockedException - parts of the specified range are already lockedpublic void unlockFile(FileHandle handle, long byteOffset, long length) throws PathNotFoundException, AccessDeniedException, NotAFileException, UnsupportedFeatureException
FileSystemunlockFile in class FullFileSystemhandle - the file handlebyteOffset - the byte offsetlength - the lengthPathNotFoundException - the path was not foundAccessDeniedException - the access is deniedNotAFileException - the path is not a fileUnsupportedFeatureException - the feature is not supportedpublic boolean supportsUnicodeFilenames()
FileSystemsupportsUnicodeFilenames in class FullFileSystempublic boolean isCompressed()
FileSystemisCompressed in class FullFileSystempublic int getVolumeSerialNumber()
FileSystemgetVolumeSerialNumber in class FullFileSystempublic boolean isReadOnly()
FileSystemisReadOnly in class FullFileSystempublic java.lang.Iterable<ExtendedAttribute> listExtendedAttributes(java.lang.String path) throws PathNotFoundException, AccessDeniedException, UnsupportedFeatureException
FileSystemlistExtendedAttributes in class FullFileSystempath - the pathPathNotFoundException - the path was not foundAccessDeniedException - the access is deniedUnsupportedFeatureException - the feature is not supportedpublic void setExtendedAttribute(java.lang.String path,
ExtendedAttribute attribute)
throws PathNotFoundException,
AccessDeniedException,
UnsupportedFeatureException
FileSystemsetExtendedAttribute in class FullFileSystempath - the pathattribute - the attribute to add/setPathNotFoundException - the path was not foundAccessDeniedException - the access is deniedUnsupportedFeatureException - the feature is not supportedpublic void removeExtendedAttribute(java.lang.String path,
java.lang.String attributeName)
throws PathNotFoundException,
AccessDeniedException,
UnsupportedFeatureException,
AttributeNotFoundException
FileSystemremoveExtendedAttribute in class FullFileSystempath - the pathattributeName - the attribute namePathNotFoundException - the path was not foundAccessDeniedException - the access is deniedUnsupportedFeatureException - the feature is not supportedAttributeNotFoundException - the specified attribute was not foundpublic java.lang.Iterable<EntityInfo> listDirectory(java.lang.String path) throws NotADirectoryException, PathNotFoundException, AccessDeniedException
FileSystemlistDirectory in class FileSystempath - the pathNotADirectoryException - the path is not a directoryPathNotFoundException - the path could not be foundAccessDeniedException - the access is deniedpublic EntityInfo getFileMetaData(java.lang.String path) throws PathNotFoundException
FileSystemgetFileMetaData in class FileSystempath - the pathPathNotFoundException - the path could not be foundpublic void rename(java.lang.String source,
java.lang.String destination)
throws PathNotFoundException,
DestinationAlreadyExistsException,
AccessDeniedException
FileSystemrename in class FileSystemsource - the source pathdestination - the destination pathPathNotFoundException - the source path or the parent directory of the destination could not be foundDestinationAlreadyExistsException - the destination already existsAccessDeniedException - the access is deniedpublic FileHandle openFile(java.lang.String file, boolean read, boolean write) throws PathNotFoundException, AccessDeniedException, NotAFileException
FileSystemopenFile in class FileSystemfile - the file to openread - whether the file should be open to readwrite - whether the file should be open to writePathNotFoundException - the file was not foundAccessDeniedException - the access is deniedNotAFileException - the given path is not a filepublic void createFile(java.lang.String path)
throws PathNotFoundException,
DestinationAlreadyExistsException,
AccessDeniedException
FileSystemcreateFile in class FileSystempath - the path to the filePathNotFoundException - the parent directory could not be foundDestinationAlreadyExistsException - the destination already exists (regardless whether it is a directory or a file)AccessDeniedException - the access is deniedpublic void createDirectory(java.lang.String path)
throws PathNotFoundException,
DestinationAlreadyExistsException,
AccessDeniedException
FileSystemcreateDirectory in class FileSystempath - the path to the new directoryPathNotFoundException - the parent directory could not be foundDestinationAlreadyExistsException - the destination already exists (regardless whether it is a directory or a file)AccessDeniedException - the access is deniedpublic int read(FileHandle handle, java.nio.ByteBuffer buffer, long offset)
FileSystemread in class FileSystemhandle - the file handlebuffer - the buffer to filloffset - the offset within the filepublic void setLength(FileHandle handle, long length) throws DriveFullException
FileSystemsetLength in class FileSystemhandle - the file handlelength - the new file size in bytesDriveFullException - there is no more spacepublic void write(FileHandle handle, java.nio.ByteBuffer buffer, long offset) throws DriveFullException, PartIsLockedException
FileSystem
Be careful: offset may be larger than the file size!
In this case you should fill everything in between with zeros.
write in class FileSystemhandle - the file handle.buffer - the buffer to writeoffset - the offset within the fileDriveFullException - there is no more spacePartIsLockedException - the specified range has been lockedpublic void flush(FileHandle handle) throws DriveFullException
FileSystemflush in class FileSystemhandle - the file handleDriveFullException - there is no more free spacepublic void close(FileHandle handle) throws DriveFullException
FileSystemclose in class FileSystemhandle - the file handleDriveFullException - there is no more spacepublic void deleteFile(java.lang.String file)
throws PathNotFoundException,
AccessDeniedException
FileSystemdeleteFile in class FileSystemfile - the filePathNotFoundException - the file could not be foundAccessDeniedException - the access is deniedpublic void deleteDirectoryRecursively(java.lang.String directory)
throws PathNotFoundException,
AccessDeniedException
FileSystemdeleteDirectoryRecursively in class FileSystemdirectory - the directoryPathNotFoundException - the directory could not be foundAccessDeniedException - the access is deniedpublic java.lang.String getVolumeName()
FileSystemgetVolumeName in class FileSystempublic java.lang.String getFileSystemName()
FileSystemgetFileSystemName in class FileSystempublic void setLastAccessTime(java.lang.String path,
long atime)
throws PathNotFoundException,
AccessDeniedException
FileSystemsetLastAccessTime in class FileSystempath - the pathatime - the last access time (unix timestamp)PathNotFoundException - the path could not be found.AccessDeniedException - the access is deniedpublic void setLastModificationTime(java.lang.String path,
long mtime)
throws PathNotFoundException,
AccessDeniedException
FileSystemsetLastModificationTime in class FileSystempath - the pathmtime - the last modification time (unix timestamp)PathNotFoundException - the path could not be found.AccessDeniedException - the access is deniedpublic void setCreationTime(java.lang.String path,
long ctime)
throws PathNotFoundException,
AccessDeniedException
FileSystemsetCreationTime in class FileSystempath - the pathctime - the creation time (unix timestamp)PathNotFoundException - the path could not be found.AccessDeniedException - the access is deniedpublic boolean isCaseSensitive()
FileSystemisCaseSensitive in class FileSystempublic int getBlockSize()
FileSystemgetBlockSize in class FileSystempublic long getTotalBlockCount()
FileSystemgetTotalBlockCount in class FileSystempublic long getFreeBlockAvailableCount()
FileSystemgetFreeBlockAvailableCount in class FileSystempublic long getFreeBlockCount()
FileSystemgetFreeBlockCount in class FileSystempublic void beforeMounting(java.lang.String mountPath)
FileSystembeforeMounting in class FullFileSystemmountPath - the mount pathpublic void beforeUnmounting()
FileSystembeforeUnmounting in class FullFileSystempublic void afterUnmounting()
FileSystemafterUnmounting in class FullFileSystem