public class DefaultNIOService extends AbstractService implements NIOService
java.nio
package, particularly
NIO ByteBuffer
objects.Constructor and Description |
---|
DefaultNIOService() |
Modifier and Type | Method and Description |
---|---|
ByteBuffer |
allocate(FileChannel channel,
FileChannel.MapMode mapMode,
long bufferStartPosition,
int newSize)
Allocates or maps the desired file data into memory.
|
getContext, setContext, toString
getInfo, getPriority, setInfo, setPriority
context
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
initialize, registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
dispose
public ByteBuffer allocate(FileChannel channel, FileChannel.MapMode mapMode, long bufferStartPosition, int newSize) throws IOException
NIOService
This method provides a facade to byte buffer allocation that enables
FileChannel.map()
usage on platforms where it's unlikely to
give us problems and heap allocation where it is.
allocate
in interface NIOService
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.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 © 2015–2022 SciJava. All rights reserved.