com.sag.osami.context.recorder.storage
Class ContextEventData

java.lang.Object
  extended by com.sag.osami.context.recorder.storage.ContextEventData

public final class ContextEventData
extends java.lang.Object

This class wraps reading and writing of context events from and to streams in a machine-independent manner.

DataInputStream and DataOutputStream are used for this, the exact format for one context event is described below:

UTF8-String UTF8-String long UTF8-String (UTF8-String)
Context origin Context type Context (UNIX-)timestamp class name of payload or empty string, if no payload serialized payload data (but only if payload class name was not empty)


Method Summary
static ContextEvent read(java.io.DataInputStream in)
          Reads a context event from a DataInputStream.
static void write(java.io.DataOutputStream out, ContextEvent ctxEvent)
          Writes a context event to a DataOutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

read

public static ContextEvent read(java.io.DataInputStream in)
                         throws java.io.IOException
Reads a context event from a DataInputStream.

Parameters:
in - the input stream
Returns:
the read context event
Throws:
java.io.IOException - on I/O errors
java.io.EOFException - when the end of the input stream was reached

write

public static void write(java.io.DataOutputStream out,
                         ContextEvent ctxEvent)
                  throws java.io.IOException
Writes a context event to a DataOutputStream.

Parameters:
out - the output stream
ctxEvent - the context event to be written
Throws:
java.io.IOException - on I/O errors