org.apache.uima.cas.impl
Class CASSerializer

java.lang.Object
  extended by org.apache.uima.cas.impl.CASSerializer
All Implemented Interfaces:
java.io.Serializable

public class CASSerializer
extends java.lang.Object
implements java.io.Serializable

Serialization for CAS. This serializes the state of the CAS, assuming that the type and index information remains constant. CASSerializer objects can be serialized with standard Java serialization.

See Also:
CASMgrSerializer, Serialized Form

Field Summary
 byte[] byteHeapArray
           
 int[] fsIndex
           
 int[] heapArray
           
 int[] heapMetaData
           
 long[] longHeapArray
           
 short[] shortHeapArray
           
 java.lang.String[] stringTable
           
 
Constructor Summary
CASSerializer()
          Constructor for CASSerializer.
 
Method Summary
 void addCAS(CASImpl cas)
          Add the CAS to be serialized.
 void addCAS(CASImpl cas, boolean addMetaData)
          Add the CAS to be serialized.
 void addCAS(CASImpl cas, java.io.OutputStream ostream)
          Serializes the CAS data and writes it to the output stream.
 void addCAS(CASImpl cas, java.io.OutputStream ostream, Marker trackingMark)
          Serializes only new and modified FS and index operations made after the tracking mark is created.
 void addNoMetaData(CASImpl casImpl)
          Serialize CAS data without heap-internal meta data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

heapArray

public int[] heapArray

heapMetaData

public int[] heapMetaData

stringTable

public java.lang.String[] stringTable

fsIndex

public int[] fsIndex

byteHeapArray

public byte[] byteHeapArray

shortHeapArray

public short[] shortHeapArray

longHeapArray

public long[] longHeapArray
Constructor Detail

CASSerializer

public CASSerializer()
Constructor for CASSerializer.

Method Detail

addNoMetaData

public void addNoMetaData(CASImpl casImpl)
Serialize CAS data without heap-internal meta data. Currently used for serialization to C++.

Parameters:
casImpl - The CAS to be serialized.

addCAS

public void addCAS(CASImpl cas)
Add the CAS to be serialized. Note that we need the implementation here, the interface is not enough.

Parameters:
cas - The CAS to be serialized.

addCAS

public void addCAS(CASImpl cas,
                   boolean addMetaData)
Add the CAS to be serialized. Note that we need the implementation here, the interface is not enough.

Parameters:
cas - The CAS to be serialized.

addCAS

public void addCAS(CASImpl cas,
                   java.io.OutputStream ostream)
Serializes the CAS data and writes it to the output stream. --------------------------------------------------------------------- Blob Format Element Size Number of Description (bytes) Elements ------------ --------- -------------------------------- 4 1 Blob key = "UIMA" in utf-8 4 1 Version (currently = 1) 4 1 size of 32-bit FS Heap array = s32H 4 s32H 32-bit FS heap array 4 1 size of 16-bit string Heap array = sSH 2 sSH 16-bit string heap array 4 1 size of string Ref Heap array = sSRH 4 2*sSRH string ref offsets and lengths 4 1 size of FS index array = sFSI 4 sFSI FS index array 4 1 size of 8-bit Heap array = s8H 1 s8H 8-bit Heap array 4 1 size of 16-bit Heap array = s16H 2 s16H 16-bit Heap array 4 1 size of 64-bit Heap array = s64H 8 s64H 64-bit Heap array --------------------------------------------------------------------- This reads in and deserializes CAS data from a stream. Byte swapping may be needed is the blob is from C++ -- C++ blob serialization writes data in native byte order.

Parameters:
cas - The CAS to be serialized. ostream The output stream.

addCAS

public void addCAS(CASImpl cas,
                   java.io.OutputStream ostream,
                   Marker trackingMark)
Serializes only new and modified FS and index operations made after the tracking mark is created. Serizlizes CAS data in binary Delta format described below and writes it to the output stream. ElementSize NumberOfElements Description ----------- ---------------- --------------------------------------------------------- 4 1 Blob key = "UIMA" in utf-8 (byte order flag) 4 1 Version (1 = complete cas, 2 = delta cas) 4 1 size of 32-bit heap array = s32H 4 s32H 32-bit FS heap array (new elements) 4 1 size of 16-bit string Heap array = sSH 2 sSH 16-bit string heap array (new strings) 4 1 size of string Ref Heap array = sSRH 4 2*sSRH string ref offsets and lengths (for new strings) 4 1 number of modified, preexisting 32-bit modified FS heap elements = sM32H 4 2*sM32H 32-bit heap offset and value (preexisting cells modified) 4 1 size of FS index array = sFSI 4 sFSI FS index array in Delta format 4 1 size of 8-bit Heap array = s8H 1 s8H 8-bit Heap array (new elements) 4 1 size of 16-bit Heap array = s16H 2 s16H 16-bit Heap array (new elements) 4 1 size of 64-bit Heap array = s64H 8 s64H 64-bit Heap array (new elements) 4 1 number of modified, preexisting 8-bit heap elements = sM8H 4 sM8H 8-bit heap offsets (preexisting cells modified) 1 sM8H 8-bit heap values (preexisting cells modified) 4 1 number of modified, preexisting 16-bit heap elements = sM16H 4 sM16H 16-bit heap offsets (preexisting cells modified) 2 sM16H 16-bit heap values (preexisting cells modified) 4 1 number of modified, preexisting 64-bit heap elements = sM64H 4 sM64H 64-bit heap offsets (preexisting cells modified) 2 sM64H 64-bit heap values (preexisting cells modified)

Parameters:
cas -
ostream -
trackingMark -


Copyright © 2012. All Rights Reserved.