org.xmlBlaster.client.protocol.http.common
Class ObjectOutputStreamMicro
java.lang.Object
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 |
private java.io.DataOutputStream |
out
|
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. |
private void |
writeHashtable(java.util.Hashtable map)
Helper to write the map to an output stream without the
use of a ObjectOutputStream (to allow to read it from j2me which
does not have ObjectInputStream) |
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)
|
private void |
writeVector(java.util.Vector vec)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
out
private java.io.DataOutputStream out
ObjectOutputStreamMicro
public ObjectOutputStreamMicro(java.io.OutputStream outStream)
throws java.io.IOException
- Throws:
java.io.IOException
writeHashtable
private void writeHashtable(java.util.Hashtable map)
throws java.io.IOException
- Helper to write the map to an output stream without the
use of a ObjectOutputStream (to allow to read it from j2me which
does not have ObjectInputStream)
- Parameters:
out
-
- Throws:
java.io.IOException
writeVector
private void writeVector(java.util.Vector vec)
throws java.io.IOException
- Throws:
java.io.IOException
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
Copyright © 1999-2014 The xmlBlaster.org contributers.