Class AntiprotonFile.Writer

  extended by edu.rit.clu.antimatter.AntiprotonFile.Writer
Enclosing class:

public class AntiprotonFile.Writer
extends Object

Class AntiprotonFile.Writer provides an object with which to write an AntiprotonFile to an output stream.

When a writer is created, the antiproton file's attributes are written to the output stream. Each time the writeSnapshot() method is called, one snapshot is written to the output stream. When finished, call the close() method.

Note: Class AntiprotonFile.Writer is not multiple thread safe.

Method Summary
 void close()
          Close the output stream.
 void writeSnapshot(Vector2D[] p, int off, Vector2D mv)
          Write a snapshot to the output stream.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


public void writeSnapshot(Vector2D[] p,
                          int off,
                          Vector2D mv)
                   throws IOException
Write a snapshot to the output stream.

The M antiproton positions starting at index off in the array p are written. Note that, depending on how the antiproton position array p has been allocated, the argument off need not be the same as the attribute L. However, the element p[off] must contain the position of antiproton L, the element p[off+1] must contain the position of antiproton L+1, and so on.

The given total momentum is also written; this must be the total momentum of the antiprotons L .. L+M-1.

p - Array of antiproton positions.
off - Index of first array element to write.
mv - Total momentum.
IllegalStateException - (unchecked exception) Thrown if snaps snapshots have already been written.
NullPointerException - (unchecked exception) Thrown if p is null. Thrown if mv is null.
IndexOutOfBoundsException - (unchecked exception) Thrown if off < 0. Thrown if off+M > p.length.
IOException - Thrown if an I/O error occurred.


public void close()
           throws IOException
Close the output stream.

IOException - Thrown if an I/O error occurred.

Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­