Package org.scijava.io.nio
Class DefaultNIOService
- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.service.AbstractService
-
- org.scijava.io.nio.DefaultNIOService
-
- All Implemented Interfaces:
Comparable<Prioritized>,Contextual,Disposable,Identifiable,Initializable,NIOService,Locatable,Logged,HasPluginInfo,RichPlugin,SciJavaPlugin,Prioritized,SciJavaService,Service,Versioned
public class DefaultNIOService extends AbstractService implements NIOService
Default service for working with thejava.niopackage, particularly NIOByteBufferobjects.- Author:
- Chris Allan, Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description DefaultNIOService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufferallocate(FileChannel channel, FileChannel.MapMode mapMode, long bufferStartPosition, int newSize)Allocates or maps the desired file data into memory.-
Methods inherited from class org.scijava.service.AbstractService
getContext, setContext, toString
-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
getInfo, getPriority, setInfo, setPriority
-
Methods inherited from class org.scijava.AbstractContextual
context
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
allocate
public ByteBuffer allocate(FileChannel channel, FileChannel.MapMode mapMode, long bufferStartPosition, int newSize) throws IOException
Description copied from interface:NIOServiceAllocates or maps the desired file data into memory.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.- Specified by:
allocatein interfaceNIOService- Parameters:
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.- Returns:
- A newly allocated or mapped NIO byte buffer.
- Throws:
IOException- If there is an issue mapping, aligning or allocating the buffer.- See Also:
- "https://bugs.java.com/bugdatabase/view_bug.do?bug_id=5092131", "https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6417205"
-
-