All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class au.com.pharos.packing.SerializationPacking

au.com.pharos.packing.Packing
   |
   +----au.com.pharos.packing.SerializationPacking

public class SerializationPacking
extends Packing
A packing strategy which stores and retrieves objects using Java serialization.

Version:
$Revision: 1.4 $
Author:
Martin Pool
See Also:
Packing

Constructor Index

 o SerializationPacking()

Method Index

 o fromBytes(byte[])
Interprets raw as a Java serialization stream, and returns the first object read from that stream.
 o toBytes(Object)
Convert an object to a Java serialization format.

Constructors

 o SerializationPacking
 public SerializationPacking()

Methods

 o toBytes
 public byte[] toBytes(Object obj) throws IllegalArgumentException
Convert an object to a Java serialization format.

Returns:
s a buffer containing a a serialized representation of obj; or null if obj if null
Throws: IllegalArgumentException
if obj (or any object referred to by obj) cannot be serialized
Overrides:
toBytes in class Packing
 o fromBytes
 public Object fromBytes(byte raw[])
Interprets raw as a Java serialization stream, and returns the first object read from that stream.

Note:There is currently no means by which any later objects in the can be retrieved: it is assumed that the object written to the buffer contains references to all the information required. This is consistent with the fact that toBytes() stores only a single object, so this packing strategy is completely reversable.

Overrides:
fromBytes in class Packing

All Packages  Class Hierarchy  This Package  Previous  Next  Index