org.apache.ddlutils.io
Class BinaryObjectsHelper

java.lang.Object
  extended by org.apache.ddlutils.io.BinaryObjectsHelper

public class BinaryObjectsHelper
extends Object

Helper class for dealing with the serialization and Base64 encoding of objects.

Version:
$Revision: $

Constructor Summary
BinaryObjectsHelper()
           
 
Method Summary
 Object decode(String base64Rep)
          Decodes an object from the serialized form encoded in the given Base64 string.
 byte[] decodeByteArray(String base64Rep)
          Decodes the given Base64 form to a byte array.
 Object deserialize(byte[] serializedForm)
          Deserializes the object from its byte array representation.
 String encode(Object obj)
          Encodes the serialized form of the given object to its Base64 form.
 String encodeByteArray(byte[] data)
          Encodes the given byte array to its Base64 form.
 byte[] serialize(Object obj)
          Serializes the given object to a byte array representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryObjectsHelper

public BinaryObjectsHelper()
Method Detail

serialize

public byte[] serialize(Object obj)
Serializes the given object to a byte array representation.

Parameters:
obj - The object to serialize
Returns:
The byte array containing the serialized form of the object

deserialize

public Object deserialize(byte[] serializedForm)
Deserializes the object from its byte array representation.

Parameters:
serializedForm - The byte array containing the serialized form of the object
Returns:
The object

encode

public String encode(Object obj)
Encodes the serialized form of the given object to its Base64 form.

Parameters:
obj - The object
Returns:
The Base64 string

encodeByteArray

public String encodeByteArray(byte[] data)
Encodes the given byte array to its Base64 form.

Parameters:
data - The data to encode
Returns:
The Base64 string

decode

public Object decode(String base64Rep)
Decodes an object from the serialized form encoded in the given Base64 string.

Parameters:
base64Rep - The serialized form encoded in Base64
Returns:
The object

decodeByteArray

public byte[] decodeByteArray(String base64Rep)
Decodes the given Base64 form to a byte array.

Parameters:
base64Rep - The Base64 string to decode
Returns:
The byte array


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.