Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.mdm.index.util
Class Serializer

    java.lang.Object
      com.sun.mdm.index.util.Serializer

public class Serializer
extends java.lang.Object

Utility methods to serialize/de-serialize an object to/from a byte array

Constructor Summary
`Serializer()` Creates new Serializer

Method Summary
`static java.lang.Object` | `bytesToObject(byte[] bArray)` de-serialize an object from a byte array
`static void` | `main(java.lang.String[] argv)` for testing purpose only
`static byte[]` | `objectToBytes(java.lang.Object obj)` Serialize an object to a byte array

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Serializer

    public Serializer()

  Creates new Serializer

Method Detail

### bytesToObject

    public static java.lang.Object bytesToObject(byte[] bArray)
                                          throws java.lang.ClassNotFoundException,
                                                 java.io.OptionalDataException,
                                                 java.io.IOException

  de-serialize an object from a byte array

  Parameters:
    `bArray` - byte array representation of the object
  Returns:
    an object de-serialized from the byte array, null if errors occurred during the process
  Throws:
    `java.lang.ClassNotFoundException` - Class of a serialized object cannot be found
    `java.io.OptionalDataException` - Primitive data was found in the stream instead of objects.
    `java.io.IOException` - failed or interrupted io operation

### main

    public static void main(java.lang.String[] argv)

  for testing purpose only

  Parameters:
    `argv` - comman line arguments. This main does not take any.

### objectToBytes

    public static byte[] objectToBytes(java.lang.Object obj)

  Serialize an object to a byte array

  Parameters:
    `obj` - object to be serialized
  Returns:
    a byte array representing the serialized object, null if errors occurred during the process

Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Sun Microsystems, Inc.