Class SerializationUtils

java.lang.Object
org.apache.uima.internal.util.SerializationUtils

public final class SerializationUtils extends Object
Serialize and Deserialize arbitrary objects to/from byte arrays, using standard Java object serialization/deserialization support. Used in the Vinci transport to serialize/deserialize CASSerializer objects or CASCompleteSerializer objects (includes type system and index definitions). This class is abstract only to prevent instantiation. All the methods are static.
  • Method Details

    • serialize

      public static byte[] serialize(Serializable aObject) throws IOException
      Serializes an object to a byte array.
      Parameters:
      aObject - object to serialize
      Returns:
      aObject encoded as a byte array. If aObject is null, null is returned.
      Throws:
      IOException - if an I/O error occurs
    • deserialize

      public static Object deserialize(byte[] aBytes) throws IOException, ClassNotFoundException
      Deserializes a supported object from a byte array. Supported objects are CASMgrSerializer, CASSerializer, CASCompleteSerializer.
      Parameters:
      aBytes - byte array to read from
      Returns:
      The Object deserialized from aBytes. If aBytes is null, null is returned.
      Throws:
      IOException - if an I/O error occurs
      ClassNotFoundException - if a required class could not be found
    • deserializeCASSerializerOrCASCompleteSerializer

      public static Object deserializeCASSerializerOrCASCompleteSerializer(InputStream aIs) throws IOException
      Deserializes a CASSerializer or CASCompleteSerializer from a byte array.
      Parameters:
      aIs - stream to read from
      Returns:
      The Object deserialized from aBytes. If aBytes is null, null is returned.
      Throws:
      IOException - if an I/O error occurs
    • deserializeCASCompleteSerializer

      public static CASCompleteSerializer deserializeCASCompleteSerializer(byte[] aBytes) throws IOException
      Deserializes a CASCompleteSerializer from a byte array.
      Parameters:
      aBytes - byte array to read from
      Returns:
      The Object deserialized from aBytes. If aBytes is null, null is returned.
      Throws:
      IOException - if an I/O error occurs
    • deserializeCASSerializer

      public static CASSerializer deserializeCASSerializer(byte[] aBytes) throws IOException
      Deserializes a CASSerializer from a byte array.
      Parameters:
      aBytes - byte array to read from
      Returns:
      The Object deserialized from aBytes. If aBytes is null, null is returned.
      Throws:
      IOException - if an I/O error occurs
    • deserializeCASMgrSerializer

      public static CASMgrSerializer deserializeCASMgrSerializer(byte[] aBytes) throws IOException
      Deserializes a CASSerializer from a byte array.
      Parameters:
      aBytes - byte array to read from
      Returns:
      The Object deserialized from aBytes. If aBytes is null, null is returned.
      Throws:
      IOException - if an I/O error occurs
    • deserializeCASMgrSerializer

      public static CASMgrSerializer deserializeCASMgrSerializer(InputStream aIn) throws IOException
      Deserializes a CASMgrSerializer from an InputStream.
      Parameters:
      aIn - stream read from
      Returns:
      The Object deserialized from aBytes. If aBytes is null, null is returned.
      Throws:
      IOException - if an I/O error occurs