public class FileBuffer extends AbstractBuffer
| Constructor and Description |
|---|
FileBuffer(String path,
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(ByteBuffer dst)
Delegates to
FileChannel |
int |
read(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(ByteBuffer src)
Delegates to
FileChannel |
int |
write(ByteBuffer src,
long position)
Delegates to
FileChannel |
getPath, toStringpublic FileBuffer(String path, String mode)
path - path to the root of the File repository.mode - will be passed to the constructor of RandomAccessFileFileNotFoundExceptionpublic void close()
throws IOException
IOException - if an I/O error occurs.public void flush(boolean includeMetadata)
throws IOException
includeMetadata - flushes also the file metadata, not just the contentIOException - an I/O error that occurredpublic int read(ByteBuffer dst) throws IOException
FileChannelIOExceptionFileChannelpublic int read(ByteBuffer dst, long position) throws IOException
FileChannelIOExceptionFileChannelpublic int write(ByteBuffer src, long position) throws IOException
FileChannelIOExceptionFileChannelpublic int write(ByteBuffer src) throws IOException
FileChannelIOExceptionFileChannelpublic long size()
throws IOException
IOExceptionpublic void truncate(long size)
throws IOException
IOExceptionpublic boolean truncateIfSmaller(long size)
throws IOException
size - IOException
Version: 5.1.4-ice35-b55
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.