@Deprecated
public class EvioCompactEventWriter
extends java.lang.Object
When this class was originally written, although much of the code was the same as
the EventWriter
class, it was different enough not to be able to easily merge
the two. However, since then things have changed. It is now rewritten to be a wrapper
around EventWriter. Maintain this class only for backward compatibility.
Constructor and Description |
---|
EvioCompactEventWriter(java.nio.ByteBuffer byteBuffer,
int blockSizeMax,
int blockCountMax,
java.lang.String xmlDictionary)
Deprecated.
Create an
EvioCompactEventWriter object for writing events to the
given buffer. |
EvioCompactEventWriter(java.lang.String baseName,
java.lang.String directory,
int runNumber,
int split,
int bufferSize,
java.nio.ByteOrder byteOrder,
java.lang.String xmlDictionary)
Deprecated.
Create an
EvioCompactEventWriter object for writing events to a file. |
EvioCompactEventWriter(java.lang.String baseName,
java.lang.String directory,
int runNumber,
int split,
int blockSizeMax,
int blockCountMax,
int bufferSize,
java.nio.ByteOrder byteOrder,
java.lang.String xmlDictionary,
boolean overWriteOK)
Deprecated.
Create an
EvioCompactEventWriter object for writing events to a file. |
EvioCompactEventWriter(java.lang.String baseName,
java.lang.String directory,
java.lang.String runType,
int runNumber,
int split,
int blockSizeMax,
int blockCountMax,
int bufferSize,
java.nio.ByteOrder byteOrder,
java.lang.String xmlDictionary,
boolean overWriteOK)
Deprecated.
Create an
EvioCompactEventWriter object for writing events to a file. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
This method flushes any remaining data to file and disables this object.
|
java.nio.ByteBuffer |
getByteBuffer()
Deprecated.
If writing to a file, return null.
|
int |
getEventsWritten()
Deprecated.
Get the number of events written to a file/buffer.
|
void |
setStartingBlockNumber(int startingBlockNumber)
Deprecated.
Set the number with which to start block numbers.
|
void |
writeEvent(java.nio.ByteBuffer eventBuffer)
Deprecated.
Write an event (bank) to the buffer in evio version 4 format.
|
public EvioCompactEventWriter(java.lang.String baseName, java.lang.String directory, int runNumber, int split, int bufferSize, java.nio.ByteOrder byteOrder, java.lang.String xmlDictionary) throws EvioException
EvioCompactEventWriter
object for writing events to a file.
It receives buffers containing evio event data (just the event data and not a
full evio 4 format) and places them into an internal buffer in full evio 4 format.
It writes out the contents of its internal buffer into a file whenever that buffer
becomes full. If the split arg is > 0, when the file size reaches the given limit,
it is closed and another created. If the file already exists, its contents will be
overwritten unless the "overWriteOK" argument is false
in
which case an exception will be thrown. If the file doesn't exist,
it will be created. Byte order defaults to big endian if arg is null.
File writing can be terminated by calling close()
which will flush all
remaining data to the file, close it, and disable this object from any more
writing.baseName
- base file name used to generate complete file name (may not be null)directory
- directory in which file is to be placedrunNumber
- number of the CODA run, used in naming filessplit
- if < 1, do not split file, write to only one file of unlimited size.
Else this is max size (in units of integral # of buffers of maxBuffersize
bytes each) to make a file before closing it and starting writing another.bufferSize
- number of bytes to make the internal buffer which will
be storing events before writing them to a file.byteOrder
- the byte order in which to write the file.xmlDictionary
- dictionary in xml format or null if none.EvioException
- if baseName is null;
if bufferSize too small;
if file exists but user requested no over-writing;public EvioCompactEventWriter(java.lang.String baseName, java.lang.String directory, int runNumber, int split, int blockSizeMax, int blockCountMax, int bufferSize, java.nio.ByteOrder byteOrder, java.lang.String xmlDictionary, boolean overWriteOK) throws EvioException
EvioCompactEventWriter
object for writing events to a file.
It receives buffers containing evio event data (just the event data and not a
full evio 4 format) and places them into an internal buffer in full evio 4 format.
It writes out the contents of its internal buffer into a file whenever that buffer
becomes full. If the split arg is > 0, when the file size reaches the given limit,
it is closed and another created. If the file already exists, its contents will be
overwritten unless the "overWriteOK" argument is false
in
which case an exception will be thrown. If the file doesn't exist,
it will be created. Byte order defaults to big endian if arg is null.
File writing can be terminated by calling close()
which will flush all
remaining data to the file, close it, and disable this object from any more
writing.Maintain this constructor for backwards compatibility.
baseName
- base file name used to generate complete file name (may not be null)directory
- directory in which file is to be placedrunNumber
- number of the CODA run, used in naming filessplit
- if < 1, do not split file, write to only one file of unlimited size.
Else this is max size in bytes (+/- blockSizeMax) to make a file
before closing it and starting writing another.blockSizeMax
- the max blocksize in bytes which must be >= 400 B and <= 4 MB.
The size of the block will not be larger than this size
unless a single event itself is larger.blockCountMax
- the max number of events in a single block which must be
>= EventWriter.MIN_BLOCK_COUNT
and
<= EventWriter.MAX_BLOCK_COUNT
.bufferSize
- number of bytes to make the internal buffer which will
be storing events before writing them to a file. Must be at least
blockSizeMax. If not, it is set to that.byteOrder
- the byte order in which to write the file.xmlDictionary
- dictionary in xml format or null if none.overWriteOK
- if false
and the file already exists,
an exception is thrown rather than overwriting it.EvioException
- if baseName is null;
if blockSizeMax or blockCountMax exceed limits;
if bufferSize too small;
if file exists but user requested no over-writing;public EvioCompactEventWriter(java.lang.String baseName, java.lang.String directory, java.lang.String runType, int runNumber, int split, int blockSizeMax, int blockCountMax, int bufferSize, java.nio.ByteOrder byteOrder, java.lang.String xmlDictionary, boolean overWriteOK) throws EvioException
EvioCompactEventWriter
object for writing events to a file.
It receives buffers containing evio event data (just the event data and not a
full evio 4 format) and places them into an internal buffer in full evio 4 format.
It writes out the contents of its internal buffer into a file whenever that buffer
becomes full. If the split arg is > 0, when the file size reaches the given limit,
it is closed and another created. If the file already exists, its contents will be
overwritten unless the "overWriteOK" argument is false
in
which case an exception will be thrown. If the file doesn't exist,
it will be created. Byte order defaults to big endian if arg is null.
File writing can be terminated by calling close()
which will flush all
remaining data to the file, close it, and disable this object from any more
writing.baseName
- base file name used to generate complete file name (may not be null)directory
- directory in which file is to be placedrunType
- name of run type configuration to be used in naming filesrunNumber
- number of the CODA run, used in naming filessplit
- if < 1, do not split file, write to only one file of unlimited size.
Else this is max size in bytes (+/- blockSizeMax) to make a file
before closing it and starting writing another.blockSizeMax
- the max blocksize in bytes which must be >= 400 B and <= 4 MB.
The size of the block will not be larger than this size
unless a single event itself is larger.blockCountMax
- the max number of events in a single block which must be
>= EventWriter.MIN_BLOCK_COUNT
and
<= EventWriter.MAX_BLOCK_COUNT
.bufferSize
- number of bytes to make the internal buffer which will
be storing events before writing them to a file. Must be at least
blockSizeMax. If not, it is set to that.byteOrder
- the byte order in which to write the file.xmlDictionary
- dictionary in xml format or null if none.overWriteOK
- if false
and the file already exists,
an exception is thrown rather than overwriting it.EvioException
- if baseName is null;
if blockSizeMax or blockCountMax exceed limits;
if bufferSize too small;
if file exists but user requested no over-writing;public EvioCompactEventWriter(java.nio.ByteBuffer byteBuffer, int blockSizeMax, int blockCountMax, java.lang.String xmlDictionary) throws EvioException
EvioCompactEventWriter
object for writing events to the
given buffer. Will overwrite any existing data in buffer!
It receives buffers containing evio event data (just the event data and not a
full evio 4 format) and places them into the given buffer in full evio 4 format.
Byte order of events to be written must match the order of the given buffer.
Writing can be terminated by calling close()
which will flush all
remaining data to the buffer and disable this object from any more writing.byteBuffer
- buffer into which events are written.blockSizeMax
- the max blocksize in bytes which must be >= 400 B and <= 4 MB.
The size of the block will not be larger than this size
unless a single event itself is larger.blockCountMax
- the max number of events in a single block which must be
>= EventWriter.MIN_BLOCK_COUNT
and <= EventWriter.MAX_BLOCK_COUNT
.xmlDictionary
- dictionary in xml format or null if none.EvioException
- if blockSizeMax or blockCountMax exceed limits;
if buffer arg is nullpublic int getEventsWritten()
public void setStartingBlockNumber(int startingBlockNumber)
startingBlockNumber
- the number with which to start block numbers.public void close()
public void writeEvent(java.nio.ByteBuffer eventBuffer) throws EvioException, java.io.IOException
eventBuffer
- the event (bank) to write in buffer formEvioException
- if event is opposite byte order of internal buffer;
if close() already called;
if bad eventBuffer format;
if file could not be opened for writing;
if file exists but user requested no over-writing;
if no room when writing to user-given buffer;java.io.IOException
- if error writing filepublic java.nio.ByteBuffer getByteBuffer()