xmlBlaster 2.2.0 client API

org.xmlBlaster.client.protocol.http.common
Class ObjectOutputStreamMicro

java.lang.Object
  extended by org.xmlBlaster.client.protocol.http.common.ObjectOutputStreamMicro
All Implemented Interfaces:
I_ObjectStream

public class ObjectOutputStreamMicro
extends java.lang.Object
implements I_ObjectStream

ObjectOutputStreamMicro

Author:
Michele Laghi

Field Summary
 
Fields inherited from interface org.xmlBlaster.client.protocol.http.common.I_ObjectStream
HASHTABLE, HASHTABLE_ARR, STRING, VECTOR
 
Constructor Summary
ObjectOutputStreamMicro(java.io.OutputStream outStream)
           
 
Method Summary
static int getMessageLength(java.lang.String oid, java.lang.String key, java.lang.String qos, byte[] content)
          Returns the length of the message in bytes.
static int writeMessage(java.io.OutputStream out, java.lang.String oid, java.lang.String key, java.lang.String qos, byte[] content)
          writes a message to the output stream.
 void writeObject(java.lang.Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectOutputStreamMicro

public ObjectOutputStreamMicro(java.io.OutputStream outStream)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

writeObject

public void writeObject(java.lang.Object obj)
                 throws java.io.IOException
Throws:
java.io.IOException

getMessageLength

public static int getMessageLength(java.lang.String oid,
                                   java.lang.String key,
                                   java.lang.String qos,
                                   byte[] content)
Returns the length of the message in bytes.

Parameters:
key -
qos -
content -
Returns:

writeMessage

public static int writeMessage(java.io.OutputStream out,
                               java.lang.String oid,
                               java.lang.String key,
                               java.lang.String qos,
                               byte[] content)
                        throws java.io.IOException
writes a message to the output stream. The format of the message is [oid]\0[key]\0[qos]\0[content] where key and qos are (optional) String objects, and the content an (optional) byte[]. So the example '\0\0\0' of length 3 is an empty message (which is not written to the stream), 'xxx\0\0\0' is a message with an oid='xxx', no key no qos and no content.

Parameters:
oid - The oid of the message (can be null)
key - The key of the message (can be null)
qos - The qos of the message (can be null)
content - The content of the message (can be null)
Returns:
The length of the message. If the length is less than 3 (i.e. the message is empty because no oid, no key, no qos nor content), then it is not written to the stream. For oid, key qos and content: emtpy elements are threated as null elements.
Throws:
java.io.IOException

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.