SalesPoint v3.3 API

util
Class StreamMarker

java.lang.Object
  extended by util.StreamMarker
All Implemented Interfaces:
Serializable

public final class StreamMarker
extends Object
implements Serializable

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
Author:
Steffen Zschaler
See Also:
Serialized Form

Constructor Summary
StreamMarker()
          Create a new StreamMarker.
 
Method Summary
 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
 

Constructor Detail

StreamMarker

public StreamMarker()
Create a new StreamMarker.

Method Detail

toString

public final String toString()
Give a string representation of this object.

Overrides:
toString in class Object
Override:
Never

SalesPoint v3.3 API