|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.jevio.ByteParser
public class ByteParser
This class controls the creating of an event by the parsing of a byte array. Unlike the EventParser class, it does not use a singleton pattern because the parsing of bytes is used primarily for reading data sent over the network or from an ET system and is used in a multithreaded environment. This class acts like EvioFile and EventParser together, except the data in our case is obtained by reading IO streams (eg. from a socket). Thus, it's much simpler than reading a file and the result is we have a byte array to parse.
Constructor Summary | |
---|---|
ByteParser()
No-arg constructor. |
Method Summary | |
---|---|
void |
addEvioListener(IEvioListener listener)
Add an Evio listener. |
boolean |
isNotificationActive()
Get the flag determining whether notification of listeners is active. |
EvioEvent |
parseEvent(byte[] bytes,
java.nio.ByteOrder byteOrder)
This is the workhorse method for parsing the byte array. |
EvioEvent |
parseEvent(java.nio.ByteBuffer buf)
This is the workhorse method for parsing the byte buffer. |
EvioEvent |
readEvent(java.io.DataInputStream in,
java.nio.ByteOrder byteOrder)
This is a method for reading data over a DataInputStream and parsing it into an EvioEvent. |
void |
removeEvioListener(IEvioListener listener)
Remove an Evio listener. |
void |
setEvioFilter(IEvioFilter evioFilter)
Set the global filter used for filtering structures. |
void |
setNotificationActive(boolean notificationActive)
Set the flag determining whether notification of listeners is active. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteParser()
Method Detail |
---|
public EvioEvent parseEvent(byte[] bytes, java.nio.ByteOrder byteOrder) throws EvioException
event.getTreeModel()
.
bytes
- the binary data to be parsed.byteOrder
- the byte order of the binary array, either
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.
EvioException
- if data not in evio format.public EvioEvent parseEvent(java.nio.ByteBuffer buf) throws EvioException
event.getTreeModel()
.
buf
- buffer of binary data to parse.
EvioException
- if data not in evio format.public EvioEvent readEvent(java.io.DataInputStream in, java.nio.ByteOrder byteOrder) throws java.io.IOException, EvioException
in
- data input stream containing binary data to parse in network byte order.byteOrder
- the byte order of the input bytes, either
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.
java.io.IOException
- if IO error.
EvioException
- if data not in evio format.public void removeEvioListener(IEvioListener listener)
listener
- The Evio listener to remove.public void addEvioListener(IEvioListener listener)
listener
- The Evio listener to add.public boolean isNotificationActive()
true
if notification of events to the listeners is active.public void setNotificationActive(boolean notificationActive)
notificationActive
- set true
if notification of events to the listeners is active.public void setEvioFilter(IEvioFilter evioFilter)
null
, the default, then all
structures will be sent to the listeners.
evioFilter
- the filter to set.IEvioFilter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |