org.planx.xmlstore.routing
Class TimestampedValue

java.lang.Object
  extended by org.planx.xmlstore.routing.TimestampedValue
All Implemented Interfaces:
Serializable, Streamable

public class TimestampedValue
extends Object
implements Streamable, Serializable

A wrapper class that adds a timestamp to any serializable object. The object is internally represented by a byte array and can both be returned as a byte array and as an object.

See Also:
Serialized Form

Constructor Summary
TimestampedValue(DataInput in)
           
TimestampedValue(Serializable obj, long timestamp)
           
 
Method Summary
 void fromStream(DataInput in)
          Reads the internal state of the Streamable object from the input stream.
 byte[] getByteArray()
          Returns the value as a byte array.
 Serializable getObject()
          Returns the value as an Object.
 long timestamp()
           
 void toStream(DataOutput out)
          Writes the internal state of the Streamable object to the output stream in a format that can later be read by the same Streamble class using the Streamable.fromStream(java.io.DataInput) method.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimestampedValue

public TimestampedValue(Serializable obj,
                        long timestamp)
                 throws IOException
Throws:
IOException

TimestampedValue

public TimestampedValue(DataInput in)
                 throws IOException
Throws:
IOException
Method Detail

fromStream

public void fromStream(DataInput in)
                throws IOException
Description copied from interface: Streamable
Reads the internal state of the Streamable object from the input stream. Immutable objects should throw an UnsupportedOperationException, and instead implement a constructor as described above.

Specified by:
fromStream in interface Streamable
Throws:
IOException

toStream

public void toStream(DataOutput out)
              throws IOException
Description copied from interface: Streamable
Writes the internal state of the Streamable object to the output stream in a format that can later be read by the same Streamble class using the Streamable.fromStream(java.io.DataInput) method.

Specified by:
toStream in interface Streamable
Throws:
IOException

timestamp

public long timestamp()

getByteArray

public byte[] getByteArray()
Returns the value as a byte array.


getObject

public Serializable getObject()
                       throws IOException
Returns the value as an Object.

Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010. All Rights Reserved.