public class ReadWriteAdapter
extends java.lang.Object
implements com.dokany.java.DokanyFileSystem
| Constructor and Description |
|---|
ReadWriteAdapter(java.nio.file.Path root,
com.dokany.java.structure.VolumeInformation volumeInformation,
java.util.concurrent.CompletableFuture<?> didMount) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
The handle is closed in this method, due to the requirements of the dokany implementation to delete a file in the cleanUp method
|
void |
closeFile(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
CloseFile is called at the end of the life of the context.
|
long |
deleteDirectory(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Check if it is possible to delete a directory.
|
long |
deleteFile(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Check if it is possible to delete a file.
|
void |
fillWin32FindData(com.sun.jna.platform.win32.WinBase.WIN32_FIND_DATA rawFillFindData,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo) |
long |
findFiles(com.sun.jna.WString rawPath,
com.dokany.java.DokanyOperations.FillWin32FindData rawFillFindData,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
List all files in the path requested.
|
long |
findFilesWithPattern(com.sun.jna.WString fileName,
com.sun.jna.WString searchPattern,
com.dokany.java.DokanyOperations.FillWin32FindData rawFillFindData,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Same as
DokanyFileSystem.findFiles(WString, DokanyOperations.FillWin32FindData, DokanyFileInfo) but with a search pattern to filter the result. |
long |
findStreams(com.sun.jna.WString rawPath,
com.dokany.java.DokanyOperations.FillWin32FindStreamData rawFillFindData,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Retrieve all NTFS Streams informations on the file.
|
long |
flushFileBuffers(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Clears buffers for this context and causes any buffered data to be written to the file.
|
long |
getDiskFreeSpace(com.sun.jna.ptr.LongByReference freeBytesAvailable,
com.sun.jna.ptr.LongByReference totalNumberOfBytes,
com.sun.jna.ptr.LongByReference totalNumberOfFreeBytes,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Retrieves information about the amount of space that is available on a disk volume, which is the total amount of space, the total amount of free space, and the total amount
of free space available to the user that is associated with the calling thread.
|
long |
getFileInformation(com.sun.jna.WString fileName,
com.dokany.java.structure.ByHandleFileInfo handleFileInfo,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
TODO: do we have to check if the handle is valid?
|
long |
getFileSecurity(com.sun.jna.WString rawPath,
int rawSecurityInformation,
com.sun.jna.Pointer rawSecurityDescriptor,
int rawSecurityDescriptorLength,
com.sun.jna.ptr.IntByReference rawSecurityDescriptorLengthNeeded,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Get specified information about the security of a file or directory.
|
protected java.nio.file.Path |
getRootedPath(com.sun.jna.WString rawPath) |
long |
getVolumeInformation(com.sun.jna.Pointer rawVolumeNameBuffer,
int rawVolumeNameSize,
com.sun.jna.ptr.IntByReference rawVolumeSerialNumber,
com.sun.jna.ptr.IntByReference rawMaximumComponentLength,
com.sun.jna.ptr.IntByReference rawFileSystemFlags,
com.sun.jna.Pointer rawFileSystemNameBuffer,
int rawFileSystemNameSize,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
TODO: this method is copy pasta.
|
protected boolean |
isSkipFile(com.sun.jna.WString filepath) |
long |
lockFile(com.sun.jna.WString rawPath,
long rawByteOffset,
long rawLength,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Lock file at a specific offset and data length.
|
long |
mounted(com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Is called when Dokany succeeded mounting the volume.
|
long |
moveFile(com.sun.jna.WString rawPath,
com.sun.jna.WString rawNewFileName,
boolean rawReplaceIfExisting,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Move a file or directory to a new location.
|
long |
readFile(com.sun.jna.WString rawPath,
com.sun.jna.Pointer rawBuffer,
int rawBufferLength,
com.sun.jna.ptr.IntByReference rawReadLength,
long rawOffset,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
ReadFile callback on the file previously opened in
DokanyFileSystem.zwCreateFile(WString, WinBase.SECURITY_ATTRIBUTES, int, int, int, int, int, DokanyFileInfo). |
long |
setAllocationSize(com.sun.jna.WString rawPath,
long rawLength,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
SetAllocationSize is used to truncate or extend a file.
|
long |
setEndOfFile(com.sun.jna.WString rawPath,
long rawByteOffset,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
SetEndOfFile is used to truncate or extend a file (physical file size).
|
long |
setFileAttributes(com.sun.jna.WString rawPath,
int rawAttributes,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Set file attributes on a specific file.
|
long |
setFileSecurity(com.sun.jna.WString rawPath,
int rawSecurityInformation,
com.sun.jna.Pointer rawSecurityDescriptor,
int rawSecurityDescriptorLength,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Sets the security of a file or directory object.
|
long |
setFileTime(com.sun.jna.WString rawPath,
com.sun.jna.platform.win32.WinBase.FILETIME rawCreationTime,
com.sun.jna.platform.win32.WinBase.FILETIME rawLastAccessTime,
com.sun.jna.platform.win32.WinBase.FILETIME rawLastWriteTime,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Set file times on a specific file.
|
long |
unlockFile(com.sun.jna.WString rawPath,
long rawByteOffset,
long rawLength,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Unlock file at a specific offset and data length.
|
long |
unmounted(com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
Is called when Dokany succeeded unmounting the volume.
|
long |
writeFile(com.sun.jna.WString rawPath,
com.sun.jna.Pointer rawBuffer,
int rawNumberOfBytesToWrite,
com.sun.jna.ptr.IntByReference rawNumberOfBytesWritten,
long rawOffset,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
WriteFile callback on the file previously opened in
DokanyFileSystem.zwCreateFile(WString, WinBase.SECURITY_ATTRIBUTES, int, int, int, int, int, DokanyFileInfo) It can be called by different thread at the same time, therefore the write/context has to
be thread safe. |
long |
zwCreateFile(com.sun.jna.WString rawPath,
com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES securityContext,
int rawDesiredAccess,
int rawFileAttributes,
int rawShareAccess,
int rawCreateDisposition,
int rawCreateOptions,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
CreateFile Dokan API callback.
|
public ReadWriteAdapter(java.nio.file.Path root,
com.dokany.java.structure.VolumeInformation volumeInformation,
java.util.concurrent.CompletableFuture<?> didMount)
public long zwCreateFile(com.sun.jna.WString rawPath,
com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES securityContext,
int rawDesiredAccess,
int rawFileAttributes,
int rawShareAccess,
int rawCreateDisposition,
int rawCreateOptions,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemNtStatus.SUCCESS when that directory can be opened and DokanyFileInfo.IsDirectory has to be set to TRUE. On the other hand, if DokanyFileInfo.IsDirectory is set to TRUE but the path targets a file, NtStatus.NOT_A_DIRECTORY must be returned.
DokanyFileInfo.Context can be used to store Data (like a filehandle) that can be retrieved in all other requests related to the Context. To avoid memory leak, Context needs to be released in DokanyFileSystem.cleanup(WString, DokanyFileInfo) .zwCreateFile in interface com.dokany.java.DokanyFileSystemrawPath - Path requested by the Kernel on the File System.
TODO: rewrite this parameter description to link to winBasesecurityContext - the security context of the kernel (see also in the windows driver API IO_SECURITY_CONTEXT)rawDesiredAccess - Permissions for file or directory. (see also in the windows API ACCESS_MASKrawFileAttributes - Provides attributes for files and directories. (see also in the .NET API System.IO.FileAttributes}rawShareAccess - Type of share access to other threads. Device and intermediate drivers usually set ShareAccess to zero, which gives the caller exclusive access to
the open file.rawCreateDisposition - Specifies the action to perform if the file does or does not exist. Can be translated into a readable thing via CreationDispositionrawCreateOptions - Specifies the options to apply when the driver creates or opens the file. (see also in the .NET API System.IO.FileOptions)dokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic void cleanup(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
cleanup in interface com.dokany.java.DokanyFileSystemrawPath - dokanyFileInfo - DokanyFileInfo with information about the file or directory.public void closeFile(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystem
CloseFile is requested after DokanyFileSystem.cleanup(WString, DokanyFileInfo) is called. Anything remaining in DokanyFileInfo.Context has to be cleared
before return.
closeFile in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.public long readFile(com.sun.jna.WString rawPath,
com.sun.jna.Pointer rawBuffer,
int rawBufferLength,
com.sun.jna.ptr.IntByReference rawReadLength,
long rawOffset,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemDokanyFileSystem.zwCreateFile(WString, WinBase.SECURITY_ATTRIBUTES, int, int, int, int, int, DokanyFileInfo). It can be called by different thread at the same time, therefore the read has to be
thread safe.readFile in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long writeFile(com.sun.jna.WString rawPath,
com.sun.jna.Pointer rawBuffer,
int rawNumberOfBytesToWrite,
com.sun.jna.ptr.IntByReference rawNumberOfBytesWritten,
long rawOffset,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemDokanyFileSystem.zwCreateFile(WString, WinBase.SECURITY_ATTRIBUTES, int, int, int, int, int, DokanyFileInfo) It can be called by different thread at the same time, therefore the write/context has to
be thread safe.writeFile in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long flushFileBuffers(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemflushFileBuffers in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long getFileInformation(com.sun.jna.WString fileName,
com.dokany.java.structure.ByHandleFileInfo handleFileInfo,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
getFileInformation in interface com.dokany.java.DokanyFileSystemfileName - handleFileInfo - dokanyFileInfo - DokanyFileInfo with information about the file or directory.public long findFiles(com.sun.jna.WString rawPath,
com.dokany.java.DokanyOperations.FillWin32FindData rawFillFindData,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemfindFiles in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long findFilesWithPattern(com.sun.jna.WString fileName,
com.sun.jna.WString searchPattern,
com.dokany.java.DokanyOperations.FillWin32FindData rawFillFindData,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemDokanyFileSystem.findFiles(WString, DokanyOperations.FillWin32FindData, DokanyFileInfo) but with a search pattern to filter the result.findFilesWithPattern in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long setFileAttributes(com.sun.jna.WString rawPath,
int rawAttributes,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemsetFileAttributes in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long setFileTime(com.sun.jna.WString rawPath,
com.sun.jna.platform.win32.WinBase.FILETIME rawCreationTime,
com.sun.jna.platform.win32.WinBase.FILETIME rawLastAccessTime,
com.sun.jna.platform.win32.WinBase.FILETIME rawLastWriteTime,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemsetFileTime in interface com.dokany.java.DokanyFileSystemrawPath - path to file or directoryrawCreationTime - time of creationrawLastAccessTime - time of last accessrawLastWriteTime - time of last modificationdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long deleteFile(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystem
You should NOT delete the file in this method, but instead you must only check whether you can delete the file or not, and return NtStatus.SUCCESS (when you can
delete it) or appropriate error codes such as NtStatus.ACCESS_DENIED, NtStatus.OBJECT_NO_LONGER_EXISTS, NtStatus.OBJECT_NAME_NOT_FOUND.
DokanyFileSystem.deleteFile(WString, DokanyFileInfo) will also be called with DokanyFileInfo.DeleteOnClose set to false to notify the driver when the file is no longer
requested to be deleted.
When you return NtStatus.SUCCESS, you get a DokanyFileSystem.cleanup(WString, DokanyFileInfo) call afterwards with DokanyFileInfo.DeleteOnClose set to true and only
then you have to actually delete the file being closed.
deleteFile in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file.NtStatusDokanyFileSystem.deleteDirectory(WString, DokanyFileInfo)public long deleteDirectory(com.sun.jna.WString rawPath,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemdeleteDirectory in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the directory.NtStatusDokanyFileSystem.deleteFile(WString, DokanyFileInfo)public long moveFile(com.sun.jna.WString rawPath,
com.sun.jna.WString rawNewFileName,
boolean rawReplaceIfExisting,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemmoveFile in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long setEndOfFile(com.sun.jna.WString rawPath,
long rawByteOffset,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemsetEndOfFile in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long setAllocationSize(com.sun.jna.WString rawPath,
long rawLength,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemsetAllocationSize in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long lockFile(com.sun.jna.WString rawPath,
long rawByteOffset,
long rawLength,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemMountOption.FILELOCK_USER_MODE is enabled.lockFile in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long unlockFile(com.sun.jna.WString rawPath,
long rawByteOffset,
long rawLength,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemMountOption.FILELOCK_USER_MODE is enabled.unlockFile in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long getDiskFreeSpace(com.sun.jna.ptr.LongByReference freeBytesAvailable,
com.sun.jna.ptr.LongByReference totalNumberOfBytes,
com.sun.jna.ptr.LongByReference totalNumberOfFreeBytes,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystem
Neither this method nor DokanyFileSystem.getVolumeInformation(Pointer, int, IntByReference, IntByReference, IntByReference, Pointer, int, DokanyFileInfo) save the DokanyFileInfo.Context. Before these methods are called,
DokanyFileSystem.zwCreateFile(WString, WinBase.SECURITY_ATTRIBUTES, int, int, int, int, int, DokanyFileInfo) may not be called. (ditto @{link DokanyOperations.CloseFile} and @{link DokanyOperations.Cleanup}).
getDiskFreeSpace in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long getVolumeInformation(com.sun.jna.Pointer rawVolumeNameBuffer,
int rawVolumeNameSize,
com.sun.jna.ptr.IntByReference rawVolumeSerialNumber,
com.sun.jna.ptr.IntByReference rawMaximumComponentLength,
com.sun.jna.ptr.IntByReference rawFileSystemFlags,
com.sun.jna.Pointer rawFileSystemNameBuffer,
int rawFileSystemNameSize,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
getVolumeInformation in interface com.dokany.java.DokanyFileSystemrawVolumeNameBuffer - rawVolumeNameSize - rawVolumeSerialNumber - rawMaximumComponentLength - rawFileSystemFlags - rawFileSystemNameBuffer - rawFileSystemNameSize - dokanyFileInfo - DokanyFileInfo with information about the file or directory.public long mounted(com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemmounted in interface com.dokany.java.DokanyFileSystempublic long unmounted(com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemunmounted in interface com.dokany.java.DokanyFileSystempublic long getFileSecurity(com.sun.jna.WString rawPath,
int rawSecurityInformation,
com.sun.jna.Pointer rawSecurityDescriptor,
int rawSecurityDescriptorLength,
com.sun.jna.ptr.IntByReference rawSecurityDescriptorLengthNeeded,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystem
Supported since version 0.6.0. You must specify the version in DeviceOptions.Version.
getFileSecurity in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic long setFileSecurity(com.sun.jna.WString rawPath,
int rawSecurityInformation,
com.sun.jna.Pointer rawSecurityDescriptor,
int rawSecurityDescriptorLength,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystem
Supported since version 0.6.0. You must specify the version in DeviceOptions.Version.
setFileSecurity in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatuspublic void fillWin32FindData(com.sun.jna.platform.win32.WinBase.WIN32_FIND_DATA rawFillFindData,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
fillWin32FindData in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.public long findStreams(com.sun.jna.WString rawPath,
com.dokany.java.DokanyOperations.FillWin32FindStreamData rawFillFindData,
com.dokany.java.structure.DokanyFileInfo dokanyFileInfo)
com.dokany.java.DokanyFileSystemMountOption.ALT_STREAM is enabled.findStreams in interface com.dokany.java.DokanyFileSystemdokanyFileInfo - DokanyFileInfo with information about the file or directory.NtStatusprotected java.nio.file.Path getRootedPath(com.sun.jna.WString rawPath)
protected boolean isSkipFile(com.sun.jna.WString filepath)
Copyright © 2018. All rights reserved.