org.apache.uima.cas.impl

## Class BinaryCasSerDes

- java.lang.Object
- - org.apache.uima.cas.impl.BinaryCasSerDes

-     public class BinaryCasSerDes
      extends Object

  Binary (mostly non compressed) CAS deserialization The methods in this class were originally part of the CASImpl, and were moved here to this class for v3 Binary non compressed CAS serialization is in class CASSerializer, but that class uses routines and data structures in this class. There is one instance of this class per CAS (shared by all views of that CAS), created at the same time the CAS is created. This instance also holds data needed for binary serialization, and deserialization. For binary delta deserialization, it uses the data computed on a previous serialization, or, if none, it re-computes it. See scanAllFSsForBinarySerialization method. The data is computed lazily, and reset with cas reset. Lifecycle: created when a CAS (any view) is first created, as part of the shared view data for that CAS. never re-created. Data created when non-delta serializing, in case needed when delta-deserializing later: xxxAuxAddr2fsa maps aux arrays to FSs heaps and nextXXXHeapAddrAfterMark (in this case mark is the end). Reset: Instance Data: baseCas - ref to the corresponding CAS (final) tsi - the CAS's type system impl (can change; each use sets it from CAS API) heaps - there is 1 main heap, and 4 aux heaps (Byte, Short, Long, and String Some uses of this class require these be materialized. (May be input or output) for Delta deserialization: 5 ints - representing the first free address in the above 5 heaps, after the mark For delta deserialization: Maps for Aux arrays representing updatable arrays (not String): From starting addr in the aux array to the corresponding V3 FS object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BinaryCasSerDes(CASImpl baseCAS)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` called by cas reset
    `static int` | `getFsSpaceReq(TOP fs, TypeImpl type)`
    `void` | `reinit(CASCompleteSerializer casCompSer)` Deserializer for CASCompleteSerializer instances - includes type system and index definitions Never delta
    `void` | `reinit(CASSerializer ser)` Deserializer for Java-object serialized instance of CASSerializer.
    `SerialFormat` | `reinit(CommonSerDes.Header h, InputStream istream, CASMgrSerializer casMgrSerializer, CasLoadMode casLoadMode, BinaryCasSerDes6 f6, AllowPreexistingFS allowPreexistingFS, TypeSystemImpl ts)` Deserialize a binary input stream, after reading the header, and optionally an externally provided type system and index spec used in compressed form 6 serialization previously This reads in and deserializes CAS data from a stream.
    `SerialFormat` | `reinit(InputStream istream)` see Blob Format in CASSerializer This reads in and deserializes CAS data from a stream.
    `CASImpl` | `setupCasFromCasMgrSerializer(CASMgrSerializer casMgrSerializer)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BinaryCasSerDes

          public BinaryCasSerDes(CASImpl baseCAS)

  - ### Method Detail

    - #### reinit

          public void reinit(CASSerializer ser)

      Deserializer for Java-object serialized instance of CASSerializer.
      Parameters:
        `ser` - - The instance to convert back to a CAS

    - #### setupCasFromCasMgrSerializer

          public CASImpl setupCasFromCasMgrSerializer(CASMgrSerializer casMgrSerializer)

    - #### reinit

          public void reinit(CASCompleteSerializer casCompSer)

      Deserializer for CASCompleteSerializer instances - includes type system and index definitions Never delta
      Parameters:
        `casCompSer` - -

    - #### reinit

          public SerialFormat reinit(InputStream istream)
                              throws CASRuntimeException

      see Blob Format in CASSerializer This reads in and deserializes CAS data from a stream. Byte swapping may be needed if the blob is from C++ -- C++ blob serialization writes data in native byte order. Supports delta deserialization. For that, the the csds from the serialization event must be used.
      Parameters:
        `istream` - -
      Returns:
        - the format of the input stream detected
      Throws:
        `CASRuntimeException` - wraps IOException

    - #### reinit

          public SerialFormat reinit(CommonSerDes.Header h,
                                     InputStream istream,
                                     CASMgrSerializer casMgrSerializer,
                                     CasLoadMode casLoadMode,
                                     BinaryCasSerDes6 f6,
                                     AllowPreexistingFS allowPreexistingFS,
                                     TypeSystemImpl ts)
                              throws CASRuntimeException

      Deserialize a binary input stream, after reading the header, and optionally an externally provided type system and index spec used in compressed form 6 serialization previously This reads in and deserializes CAS data from a stream. Byte swapping may be needed if the blob is from C++ -- C++ blob serialization writes data in native byte order. The corresponding serialization code is in org.apache.uima.cas.impl.Serialization, also see CasIOUtils
      Parameters:
        `h` - -
        `istream` - -
        `casMgrSerializer` - null or the Java object representing the externally supplied type and maybe indexes definition (TSI)
        `casLoadMode` - DEFAULT or REINIT. REINIT required with compressed form 6 to reinitialize the cas's type system and index definition, for form 6.
        `f6` - only used for form 6 where an instance of BinaryCasSerDes6 has been initialized
        `allowPreexistingFS` - only used for form 6 delta deserialization
        `ts` - the type system
      Returns:
        the format that was deserialized
      Throws:
        `CASRuntimeException` - wraps IOException

    - #### getFsSpaceReq

          public static int getFsSpaceReq(TOP fs,
                                          TypeImpl type)

    - #### clear

          public void clear()

      called by cas reset

Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.