lcsim/src/org/lcsim/util/loop
diff -u -r1.8 -r1.9
--- LCIODriver.java 17 Oct 2007 02:06:25 -0000 1.8
+++ LCIODriver.java 10 Sep 2008 21:25:01 -0000 1.9
@@ -21,82 +21,105 @@
*/
public class LCIODriver extends Driver
{
- private LCIOWriter writer;
-
- public LCIODriver(String file)
- {
- this(file,null);
- }
- public LCIODriver(File file)
- {
- this(file,null);
- }
- public LCIODriver(String file, Collection<String> listIgnore)
- {
- this(new File(file),listIgnore);
- }
- public LCIODriver(File file, Collection<String> listIgnore)
- {
- try
- {
- this.writer = new LCIOWriter(file,listIgnore == null ? Collections.EMPTY_SET : listIgnore);
- }
- catch (IOException x)
- {
- throw new RuntimeException("Error opening LCIO file",x);
- }
- }
- public LCIODriver(LCIOWriter writer)
- {
- this.writer = writer;
- }
- public LCIOWriter getWriter()
- {
- return writer;
- }
- protected void startOfData()
- {
- try
- {
- writer.reOpen();
- }
- catch (IOException x)
- {
- throw new RuntimeException("Error rewinding LCIO file",x);
- }
- }
- protected void endOfData()
- {
- try
- {
- writer.close();
- }
- catch (IOException x)
- {
- throw new RuntimeException("Error rewinding LCIO file",x);
- }
- }
- protected void process(EventHeader event)
- {
- try
- {
- writer.write(event);
- }
- catch (IOException x)
- {
- throw new RuntimeException("Error writing LCIO file",x);
- }
- }
-
- protected void suspend()
- {
- try
- {
- writer.flush();
- }
- catch (IOException x)
- {
- throw new RuntimeException("Error flushing LCIO file",x);
- }
- }
+ private LCIOWriter writer;
+
+ public LCIODriver(String file)
+ {
+ this(file,null);
+ }
+
+ public LCIODriver(File file)
+ {
+ this(file,null);
+ }
+
+ public LCIODriver(String file, Collection<String> listIgnore)
+ {
+ this(new File(file),listIgnore);
+ }
+
+ public LCIODriver(File file, Collection<String> listIgnore)
+ {
+ try
+ {
+ this.writer = new LCIOWriter(file,listIgnore == null ? Collections.EMPTY_SET : listIgnore);
+ }
+ catch (IOException x)
+ {
+ throw new RuntimeException("Error opening LCIO file",x);
+ }
+ }
+
+ public LCIODriver(LCIOWriter writer)
+ {
+ this.writer = writer;
+ }
+
+ public LCIODriver()
+ {}
+
+ public void setOutputFilePath(String outputFilePath)
+ {
+ try
+ {
+ this.writer = new LCIOWriter(new File(outputFilePath),Collections.EMPTY_SET);
+ }
+ catch (IOException x)
+ {
+ throw new RuntimeException("Error opening LCIO file",x);
+ }
+ }
+
+ public LCIOWriter getWriter()
+ {
+ return writer;
+ }
+
+ protected void startOfData()
+ {
+ try
+ {
+ writer.reOpen();
+ }
+ catch (IOException x)
+ {
+ throw new RuntimeException("Error rewinding LCIO file",x);
+ }
+ }
+
+ protected void endOfData()
+ {
+ try
+ {
+ writer.close();
+ }
+ catch (IOException x)
+ {
+ throw new RuntimeException("Error rewinding LCIO file",x);
+ }
+ }
+
+ protected void process(EventHeader event)
+ {
+ try
+ {
+ writer.write(event);
+ }
+ catch (IOException x)
+ {
+ throw new RuntimeException("Error writing LCIO file",x);
+ }
+ }
+
+ protected void suspend()
+ {
+ try
+ {
+ writer.flush();
+ }
+ catch (IOException x)
+ {
+ throw new RuntimeException("Error flushing LCIO file",x);
+ }
+ }
}