|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jlab.coda.jevio.EvioFile
public class EvioFile
This is the a class of interest to the user. Create an EvioFile
from a File
object corresponding to an event file, and from this class you can test the file for consistency and,
more importantly, you can call parseNextEvent
to get new events and to stream the embedded
structures to an IEvioListener.
The streaming effect of parsing an event is that the parser will read the event and hand off structures,
such as banks, to any IEvioListeners. For those familiar with XML, the event is processed SAX-like.
It is up to the listener to decide what to do with the structures.
As an alternative to stream processing, after an event is parsed, the user can use the events treeModel for access to the structures. For those familiar with XML, the event is processed DOM-like.
NOTE: Even though this class has a constructor that accepts an i/o mode, that is for backwards
compatibility only. An EvioFile
is used for reading and parsing events only.
To write an event file, use an EventWriter
object.
Nested Class Summary | |
---|---|
static class |
EvioFile.ReadStatus
Deprecated. This enum denotes the status of a read. |
static class |
EvioFile.WriteStatus
Deprecated. This enum denotes the status of a write.SUCCESS indicates a successful write. |
Constructor Summary | |
---|---|
EvioFile(java.io.File file)
Deprecated. Creates an event file for reading. |
|
EvioFile(java.lang.String path)
Deprecated. Creates an event file. |
Method Summary | |
---|---|
void |
close()
Deprecated. This is equivalent to closing the file. |
static boolean |
compareEventFiles(java.io.File evFile1,
java.io.File evFile2)
Deprecated. Method used for diagnostics. |
int |
fileSize()
Deprecated. Obtain the file size using the memory mapped buffer's capacity, which should be the same. |
IBlockHeader |
getCurrentBlockHeader()
Deprecated. This returns the current (active) block (physical record) header. |
int |
getEventCount()
Deprecated. This is the number of events in the file. |
java.nio.MappedByteBuffer |
getMappedByteBuffer()
Deprecated. Get the memory mapped buffer corresponding to the event file. |
int |
getNumEventsRemaining()
Deprecated. Get the number of events remaining in the file. |
EventParser |
getParser()
Deprecated. Get the file/buffer parser. |
java.lang.String |
getPath()
Deprecated. Get the path to the file. |
java.lang.String |
getXmlDictionary()
Deprecated. Get the xml format dictionary is there is one. |
EvioEvent |
gotoEventNumber(int evNumber)
Deprecated. Go to a specific event in the file. |
boolean |
hasDictionary()
Deprecated. Does this evio file have an associated dictionary? |
EvioEvent |
nextEvent()
Deprecated. Get the next event in the file. |
void |
parseEvent(EvioEvent evioEvent)
Deprecated. This will parse an event, SAX-like. |
EvioEvent |
parseNextEvent()
Deprecated. This is the workhorse method. |
int |
position()
Deprecated. This is equivalent to obtaining the current position in the file. |
void |
position(int position)
Deprecated. This is equivalent to setting the current position in the file. |
void |
rewind()
Deprecated. The equivalent of rewinding the file. |
void |
setParser(EventParser parser)
Deprecated. Set the file/buffer parser. |
EvioFile.WriteStatus |
toXMLFile(java.lang.String path)
Deprecated. Rewrite the entire file to XML. |
EvioFile.WriteStatus |
toXMLFile(java.lang.String path,
IEvioProgressListener progressListener)
Deprecated. Rewrite the file to XML (not including dictionary). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EvioFile(java.io.File file) throws java.io.IOException
file
- the file that contains EVIO events.
java.io.IOException
public EvioFile(java.lang.String path) throws java.io.IOException
path
- the full path to the file that contains events.
For writing event files, use an EventWriter
object.
java.io.IOException
EventWriter
Method Detail |
---|
public java.lang.String getPath()
public EventParser getParser()
public void setParser(EventParser parser)
parser
- file/buffer parser.public java.lang.String getXmlDictionary()
public boolean hasDictionary()
true
if this evio file has an associated dictionary,
else false
public int getNumEventsRemaining() throws EvioException
EvioException
- if failed reading from coda v3 filepublic int fileSize()
public java.nio.MappedByteBuffer getMappedByteBuffer()
public EvioEvent nextEvent() throws EvioException
parseNextEvent
instead, since it combines combines getting the next
event with parsing the next event.In evio version 4, events no longer cross block boundaries. There are only one or more complete events in each block. No changes were made to this method from versions 2 & 3 in order to read the version 4 format as it is subset of versions 1-3 with variable block length.
null
.
EvioException
public EvioEvent parseNextEvent() throws EvioException
null
.
EvioException
public void parseEvent(EvioEvent evioEvent) throws EvioException
parseNextEvent
instead,
since it combines combines getting the next event with parsing the next event .
evioEvent
- the event to parse.
EvioException
public void rewind()
position
and the close
method, allows
applications to treat this in a normal random access file manner.
public int position()
rewind
, position(int)
and the
close
method, allows applications to treat this in a normal random access file manner.
public void position(int position)
rewind
, position()
and the
close
method, allows applications to treat this in a normal random access file manner.
position
- the new position of the file.public void close()
rewind
and the two position()
methods, allows applications to treat this in a normal random access file manner.
public IBlockHeader getCurrentBlockHeader()
EvioFileTest
class.
public EvioEvent gotoEventNumber(int evNumber)
evNumber
- the event number in a 1..N counting sense, from the start of the file.
public EvioFile.WriteStatus toXMLFile(java.lang.String path)
path
- the path to the XML file.
public EvioFile.WriteStatus toXMLFile(java.lang.String path, IEvioProgressListener progressListener)
path
- the path to the XML file.progressListener
- and optional progress listener, can be null
.
IEvioProgressListener
public int getEventCount() throws EvioException
EvioException
public static boolean compareEventFiles(java.io.File evFile1, java.io.File evFile2)
evFile1
- first file to be comparedevFile2
- second file to be compared
true
if the files are, byte-by-byte, identical.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |