Class OpenFile
java.lang.Object
org.cryptomator.frontend.dokany.adapter.OpenHandle
org.cryptomator.frontend.dokany.adapter.OpenFile
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
OpenRestrictedFile
-
Field Summary
Fields inherited from class org.cryptomator.frontend.dokany.adapter.OpenHandle
path -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintappend(com.sun.jna.Pointer buf, int num) booleanTest if we can delete this file.voidclose()voidflush()static OpenFileopen(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) intread(com.sun.jna.Pointer buf, int num, long offset) Reads up tonumbytes beginning atoffsetintobuftoString()voidtruncate(long size) intwrite(com.sun.jna.Pointer buf, int num, long offset) Writes up tonumbytes frombufinto the current file beginning atoffset
-
Constructor Details
-
OpenFile
-
-
Method Details
-
read
Reads up tonumbytes beginning atoffsetintobuf- 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
Writes up tonumbytes frombufinto the current file beginning atoffset- 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.
-
append
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classOpenHandle- Throws:
IOException
-
flush
- Throws:
IOException
-
truncate
- Throws:
IOException
-
canBeDeleted
public boolean canBeDeleted()Test if we can delete this file.- Returns:
trueif no concurrent routine holds a lock on this file or the file is opened as read-only
-
toString
-
open
public static OpenFile open(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Throws:
IOException
-