Class OpenRestrictedFile
java.lang.Object
org.cryptomator.frontend.dokany.adapter.OpenHandle
org.cryptomator.frontend.dokany.adapter.OpenFile
org.cryptomator.frontend.dokany.adapter.OpenRestrictedFile
- All Implemented Interfaces:
Closeable,AutoCloseable
A File where no FileChannel to the data is opened. Should be useed, if the file is e.g. invalid but should be deleteable.
-
Field Summary
Fields inherited from class org.cryptomator.frontend.dokany.adapter.OpenHandle
path -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTest if we can delete this file.voidclose()voidflush()static OpenRestrictedFileintread(com.sun.jna.Pointer buf, int num, long offset) Reads up tonumbytes beginning atoffsetintobufvoidtruncate(long size) intwrite(com.sun.jna.Pointer buf, int num, long offset) Writes up tonumbytes frombufinto the current file beginning atoffset
-
Constructor Details
-
OpenRestrictedFile
-
-
Method Details
-
read
Description copied from class:OpenFileReads up tonumbytes beginning atoffsetintobuf- Overrides:
readin classOpenFile- Parameters:
buf- Buffernum- Number of bytes to readoffset- Position of first byte to read- Returns:
- Actual number of bytes read (can be less than
numif reached EOF). - Throws:
IOException- If an exception occurs during read.
-
write
Description copied from class:OpenFileWrites up tonumbytes frombufinto the current file beginning atoffset- Overrides:
writein classOpenFile- Parameters:
buf- Buffernum- Number of bytes to writeoffset- Position of first byte to write at- Returns:
- Actual number of bytes written TODO: only the bytes which contains information or also some filling zeros?
- Throws:
IOException- If an exception occurs during write.
-
flush
- Overrides:
flushin classOpenFile- Throws:
IOException
-
truncate
- Overrides:
truncatein classOpenFile- Throws:
IOException
-
canBeDeleted
public boolean canBeDeleted()Description copied from class:OpenFileTest if we can delete this file.- Overrides:
canBeDeletedin classOpenFile- Returns:
trueif no concurrent routine holds a lock on this file or the file is opened as read-only
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOpenFile- Throws:
IOException
-
open
-