org.objectweb.jonas.discovery.internal.utils
Class DiscoveryHelper
java.lang.Object
org.objectweb.jonas.discovery.internal.utils.DiscoveryHelper
public class DiscoveryHelper
- extends Object
This class helps creating a byte[] to be sent in a datagram when sending a DiscMessage, and helps
reading the sent DiscMessage on receiving an object when this object is actually a DiscMessage.
- Author:
- Adriana Danes
Method Summary |
static Object |
bytesToObject(byte[] bytes)
|
static byte[] |
objectToBytes(Object obj)
Construct a byte[] containing type info about a DiscMessage object to be sent,
plus the content of this message. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DiscoveryHelper
public DiscoveryHelper()
objectToBytes
public static byte[] objectToBytes(Object obj)
throws IOException
- Construct a byte[] containing type info about a DiscMessage object to be sent,
plus the content of this message.
- Parameters:
obj
- Object to be send. Only supported DiscMessage objects.
- Returns:
- Null if the object is not an instance of DiscMessage or one of its subclasses.
- Throws:
IOException
- Could not create an ObjectOutputStream to write into the
underlying ByteArrayOutputStream.
bytesToObject
public static Object bytesToObject(byte[] bytes)
throws IOException,
ClassNotFoundException
- Parameters:
bytes
- byte[] containing a received message
- Returns:
- Null if the object in the received message is not of one of the known types, or the object which
have been sent.
- Throws:
IOException
- Could not create an ObjectInputStream to read in it
ClassNotFoundException
- Class of a serialized object cannot be found
Copyright © 2007 OW2 Consortium. All Rights Reserved.