Package org.apache.uima.cas.impl
Class BinaryCasSerDes
java.lang.Object
org.apache.uima.cas.impl.BinaryCasSerDes
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
called by cas resetstatic int
getFsSpaceReq
(TOP fs, TypeImpl type) reinit
(InputStream istream) see Blob Format in CASSerializer This reads in and deserializes CAS data from a stream.void
reinit
(CASCompleteSerializer casCompSer) Deserializer for CASCompleteSerializer instances - includes type system and index definitions Never deltavoid
reinit
(CASSerializer ser) Deserializer for Java-object serialized instance of CASSerializer.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.setupCasFromCasMgrSerializer
(CASMgrSerializer casMgrSerializer)
-
Constructor Details
-
BinaryCasSerDes
-
-
Method Details
-
reinit
Deserializer for Java-object serialized instance of CASSerializer.- Parameters:
ser
- - The instance to convert back to a CAS
-
setupCasFromCasMgrSerializer
-
reinit
Deserializer for CASCompleteSerializer instances - includes type system and index definitions Never delta- Parameters:
casCompSer
- -
-
reinit
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 initializedallowPreexistingFS
- only used for form 6 delta deserializationts
- the type system- Returns:
- the format that was deserialized
- Throws:
CASRuntimeException
- wraps IOException
-
getFsSpaceReq
-
clear
public void clear()called by cas reset
-