public class MappedMemoryHandler
extends java.lang.Object
The problem is that we do NOT want an evio event which is split between 2 different memory maps. This is addressed by scanning a memory map of the largest size to find the last complete evio block it contains. The next memory map then starts at the following block.
Just a note about synchronization. This object is NOT threadsafe but it
doesn't have to be since its use in EvioReader
is synchronized and
therefore there should be not be thread unsafe.
Constructor and Description |
---|
MappedMemoryHandler(java.nio.ByteBuffer evioBuf)
Constructor.
|
MappedMemoryHandler(java.nio.channels.FileChannel channel,
java.nio.ByteOrder byteOrder)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getBlockCount()
Get the number of evio blocks in the file/buffer.
|
java.nio.ByteBuffer |
getByteBuffer(int eventNumber)
Get the ByteBuffer object containing the event of interest.
|
int |
getEventCount()
Get the number of evio events in the file/buffer.
|
java.nio.ByteBuffer |
getFirstMap()
Get the first memory map - used to map the beginning of the file.
|
int |
getMapCount()
Get the number of memory maps used to fully map file.
|
boolean |
isEvioErrorCondition()
Is there an evio error in the file/buffer.
|
public MappedMemoryHandler(java.nio.channels.FileChannel channel, java.nio.ByteOrder byteOrder) throws java.io.IOException
channel
- file's file channel objectbyteOrder
- byte order of the datajava.io.IOException
- if could not map filepublic MappedMemoryHandler(java.nio.ByteBuffer evioBuf)
evioBuf
- buffer to analyzepublic boolean isEvioErrorCondition()
true
if error, else false
public int getEventCount()
public int getBlockCount()
public int getMapCount()
public java.nio.ByteBuffer getFirstMap()
public java.nio.ByteBuffer getByteBuffer(int eventNumber)
eventNumber
- number of the desired event (starting at 0)