public class NIOByteBufferProvider extends Object
Constructor and Description |
---|
NIOByteBufferProvider(FileChannel channel,
FileChannel.MapMode mapMode)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ByteBuffer |
allocate(long bufferStartPosition,
int newSize)
Allocates or maps the desired file data into memory.
|
protected ByteBuffer |
allocateDirect(long bufferStartPosition,
int newSize)
Allocates memory and copies the desired file data into it.
|
protected ByteBuffer |
allocateMappedByteBuffer(long bufferStartPosition,
int newSize)
Memory maps the desired file data into memory.
|
public NIOByteBufferProvider(FileChannel channel, FileChannel.MapMode mapMode)
channel
- File channel to allocate or map byte buffers from.mapMode
- The map mode. Required but only used if memory mapped I/O
is to occur.public ByteBuffer allocate(long bufferStartPosition, int newSize) throws IOException
bufferStartPosition
- The absolute position of the start of the
buffer.newSize
- The buffer size.IOException
- If there is an issue mapping, aligning or allocating
the buffer.protected ByteBuffer allocateDirect(long bufferStartPosition, int newSize) throws IOException
bufferStartPosition
- The absolute position of the start of the
buffer.newSize
- The buffer size.IOException
- If there is an issue aligning or allocating
the buffer.protected ByteBuffer allocateMappedByteBuffer(long bufferStartPosition, int newSize) throws IOException
bufferStartPosition
- The absolute position of the start of the
buffer.newSize
- The buffer size.IOException
- If there is an issue mapping, aligning or allocating
the buffer.Copyright © 2014 Open Microscopy Environment