Package org.apache.jena.dboe.base.file
Interface BinaryDataFile
-
- All Superinterfaces:
org.apache.jena.atlas.lib.Closeable,org.apache.jena.atlas.lib.Sync
- All Known Implementing Classes:
BinaryDataFileMem,BinaryDataFileRandomAccess,BinaryDataFileSync,BinaryDataFileWrapper,BinaryDataFileWriteBuffered
public interface BinaryDataFile extends org.apache.jena.atlas.lib.Closeable, org.apache.jena.atlas.lib.SyncAn append-only, read-anywhere, binary file. ABinaryDataFiledoes not record the length and assumes the entries are self-defining.- See Also:
RandomAccessFile
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()default booleanisEmpty()Return whether this is an empty file or notbooleanisOpen()Is it open?longlength()Return the length of the file (including any buffered writes)voidopen()Open the filedefault intread(long posn, byte[] b)Read into a byte array, returning the number of bytes read.intread(long posn, byte[] b, int start, int length)Read into a byte array, returning the number of bytes read.voidsync()voidtruncate(long length)Truncate the filedefault longwrite(byte[] b)Write bytes - bytes are always written to the end of the file.longwrite(byte[] b, int start, int length)Write bytes - bytes are always written to the end of the file.
-
-
-
Method Detail
-
open
void open()
Open the file
-
isOpen
boolean isOpen()
Is it open?
-
read
default int read(long posn, byte[] b)Read into a byte array, returning the number of bytes read. Reads are at an absolute position and a read is atomic/thread-safe.- Parameters:
posn- Location of the read operation.b- byte array- Returns:
- The number of bytes read
-
read
int read(long posn, byte[] b, int start, int length)Read into a byte array, returning the number of bytes read. Reads are at an absolute position and a read is atomic/thread-safe.- Parameters:
posn- Location of the read operation.b-start- of bytesarray to read intolength- Maximum number of bytes to read.- Returns:
- The number of bytes read
-
write
default long write(byte[] b)
Write bytes - bytes are always written to the end of the file. Return the location where the write started.
-
write
long write(byte[] b, int start, int length)Write bytes - bytes are always written to the end of the file. Return the location where the write started.
-
length
long length()
Return the length of the file (including any buffered writes)
-
truncate
void truncate(long length)
Truncate the file
-
isEmpty
default boolean isEmpty()
Return whether this is an empty file or not
-
sync
void sync()
- Specified by:
syncin interfaceorg.apache.jena.atlas.lib.Sync
-
close
void close()
- Specified by:
closein interfaceorg.apache.jena.atlas.lib.Closeable
-
-