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, toStringpublic 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 RandomAccessFilejava.io.FileNotFoundExceptionpublic 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
FileChanneljava.io.IOExceptionFileChannel.read(ByteBuffer)public int read(java.nio.ByteBuffer dst,
long position)
throws java.io.IOException
FileChanneljava.io.IOExceptionFileChannel.read(ByteBuffer, long)public int write(java.nio.ByteBuffer src,
long position)
throws java.io.IOException
FileChanneljava.io.IOExceptionFileChannel.write(ByteBuffer, long)public int write(java.nio.ByteBuffer src)
throws java.io.IOException
FileChanneljava.io.IOExceptionFileChannel.write(ByteBuffer)public long size()
throws java.io.IOException
java.io.IOExceptionpublic void truncate(long size)
throws java.io.IOException
java.io.IOExceptionpublic boolean truncateIfSmaller(long size)
throws java.io.IOException
size - java.io.IOException
Version: 5.4.8-ice35-b99
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.