org.salespointframework.core
Class StreamMarker
java.lang.Object
org.salespointframework.core.StreamMarker
public final class StreamMarker
- extends java.lang.Object
An Object to mark positions in ObjectStreams.
You can use a StreamMarker to mark the end of a flow of objects of
unknown class and unknown size. On reading you will then know exactly up to
where you must read.
E.g. to store some objects out of an enumeration and reread them into a
vector you could use code similar to the following:
...
Enumeration e = q.elements();
ObjectOutputStream o = new ObjectOutputStream (fileOutputStream);
while (e.hasMoreElements())
o.writeObject (e.nextElement());
// Set the Marker:
o.writeObject (new StreamMarker());
...
Vector v = new Vector();
ObjectInputStream oi = new ObjectInputStream (fileInputStream);
Object ob = oi.readObject();
while (!(ob instanceof StreamMarker)) {
v.addElement (ob);
ob = oi.readObject();
}
...
- Since:
- v1.0
- Version:
- 1.0
- Author:
- Steffen Zschaler
Constructor Summary |
StreamMarker()
Create a new StreamMarker. |
Method Summary |
java.lang.String |
toString()
Give a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
StreamMarker
public StreamMarker()
- Create a new StreamMarker.
toString
public final java.lang.String toString()
- Give a string representation of this object.
- Overrides:
toString
in class java.lang.Object