java.lang.Object
edu.internet2.middleware.grouper.ext.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 Details

    • BinaryObjectsHelper

      public BinaryObjectsHelper()
  • Method Details

    • 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