org.jlab.coda.jevio
Class EventWriter

java.lang.Object
  extended by org.jlab.coda.jevio.EventWriter

public class EventWriter
extends java.lang.Object

An EventWriter object is used for writing events to a file.

Author:
heddle

Constructor Summary
EventWriter(java.io.File file)
          Creates an event writer for writing to a file.
EventWriter(java.io.File file, int blockSize)
          Create an EventWriter for writing events to a file.
EventWriter(java.io.File file, int blockSize, boolean okToDelete)
          Create an EventWriter for writing events to a file.
EventWriter(java.lang.String filename)
          Creates an event writer for writing to a file.
 
Method Summary
 void close()
          Close the underlying data output stream, and with it the file.
static void main(java.lang.String[] args)
          Main program for testing.
 void writeEvent(EvioBank bank)
          Write a bank to the file in evio version 2 format.
 void writeEvent(EvioBank bank, int version)
          Write a to the file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventWriter

public EventWriter(java.io.File file)
            throws EvioException
Creates an event writer for writing to a file.

Parameters:
file - the file to write to. Will be created.
WARNING: If the file already exists, an attempt will be made to delete it. Appending to an existing event file is not supported.
Throws:
EvioException

EventWriter

public EventWriter(java.lang.String filename)
            throws EvioException
Creates an event writer for writing to a file.

Parameters:
filename - name of the file to write to. Will be created.
WARNING: If the file already exists, an attempt will be made to delete it. Appending to an existing event file is not supported.
Throws:
EvioException

EventWriter

public EventWriter(java.io.File file,
                   int blockSize)
            throws EvioException
Create an EventWriter for writing events to a file.

Parameters:
file - the file to write to. Will be created.
WARNING: If the file already exists, an attempt will be made to delete it. Appending to an existing event file is not supported.
blockSize - the blocksize to use. A typical number is 8192. Must be a multiple of 256 with a max value of 32768.
Throws:
EvioException

EventWriter

public EventWriter(java.io.File file,
                   int blockSize,
                   boolean okToDelete)
            throws EvioException
Create an EventWriter for writing events to a file.

Parameters:
file - the file to write to. Will be created.
WARNING: If the file already exists, an attempt will be made to delete it. Appending to an existing event file is not supported.
blockSize - the blocksize to use. A typical number is 8192. Must be a multiple of 256 with a max value of 32768.
okToDelete - if true and the file already exists, an attempt will be made to delete the existing file. Appending to an existing event file is not supported at this time.
Throws:
EvioException
Method Detail

close

public void close()
Close the underlying data output stream, and with it the file.


writeEvent

public void writeEvent(EvioBank bank,
                       int version)
                throws EvioException
Write a to the file.

Parameters:
bank - the bank to write.
version - the evio version number which determines output file format.
Throws:
EvioException

writeEvent

public void writeEvent(EvioBank bank)
                throws EvioException
Write a bank to the file in evio version 2 format.

Parameters:
bank - the bank to write.
Throws:
EvioException

main

public static void main(java.lang.String[] args)
Main program for testing.

Parameters:
args - ignored command line arguments.