public class FileBuffer extends AbstractBuffer
Constructor and Description |
---|
FileBuffer(java.lang.String path,
java.lang.String mode)
Default constructor allowing to pass in a non-"rw" file mode.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the buffer, cleaning up file state.
|
void |
flush(boolean includeMetadata)
Flush the buffer, writing any pending content to the underlying storage device,
optionally also the file's metadata.
|
int |
read(java.nio.ByteBuffer dst)
Delegates to
FileChannel |
int |
read(java.nio.ByteBuffer dst,
long position)
Delegates to
FileChannel |
long |
size() |
void |
truncate(long size) |
boolean |
truncateIfSmaller(long size)
Only truncate if the size of the file is less than the size argument.
|
int |
write(java.nio.ByteBuffer src)
Delegates to
FileChannel |
int |
write(java.nio.ByteBuffer src,
long position)
Delegates to
FileChannel |
getPath, toString
public FileBuffer(java.lang.String path, java.lang.String mode)
path
- path to the root of the File
repository.mode
- will be passed to the constructor of RandomAccessFile
java.io.FileNotFoundException
public void close() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.public void flush(boolean includeMetadata) throws java.io.IOException
includeMetadata
- flushes also the file metadata, not just the contentjava.io.IOException
- an I/O error that occurredpublic int read(java.nio.ByteBuffer dst) throws java.io.IOException
FileChannel
java.io.IOException
FileChannel.read(ByteBuffer)
public int read(java.nio.ByteBuffer dst, long position) throws java.io.IOException
FileChannel
java.io.IOException
FileChannel.read(ByteBuffer, long)
public int write(java.nio.ByteBuffer src, long position) throws java.io.IOException
FileChannel
java.io.IOException
FileChannel.write(ByteBuffer, long)
public int write(java.nio.ByteBuffer src) throws java.io.IOException
FileChannel
java.io.IOException
FileChannel.write(ByteBuffer)
public long size() throws java.io.IOException
java.io.IOException
public void truncate(long size) throws java.io.IOException
java.io.IOException
public boolean truncateIfSmaller(long size) throws java.io.IOException
size
- java.io.IOException
Version: 5.4.4-ice35-b82
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.