public class XCASDeserializer extends Object
Constructor and Description |
---|
XCASDeserializer(TypeSystem ts) |
XCASDeserializer(TypeSystem ts,
UimaContext uimaContext)
Create a new deserializer from a type system.
|
Modifier and Type | Method and Description |
---|---|
static void |
deserialize(InputStream aStream,
CAS aCAS)
Deserializes an XCAS from a stream.
|
static void |
deserialize(InputStream aStream,
CAS aCAS,
boolean aLenient)
Deserializes an XCAS from a stream.
|
String |
getDocumentTypeName()
Gets the name of the type representing the document.
|
DefaultHandler |
getXCASHandler(CAS cas)
Create a default handler for deserializing an XCAS into the
cas parameter. |
DefaultHandler |
getXCASHandler(CAS cas,
org.apache.uima.cas.impl.OutOfTypeSystemData outOfTypeSystemData)
Create a default handler for deserializing an XCAS into the
cas parameter. |
void |
setDocumentTypeName(String aDocTypeName)
Gets the name of the type representing the document.
|
public XCASDeserializer(TypeSystem ts, UimaContext uimaContext)
getXCASHandler()
must have this type system as their type system.ts
- The type system of the CASes to be deserialized.uimaContext
- the UIMA Context for the deserializationpublic XCASDeserializer(TypeSystem ts)
public DefaultHandler getXCASHandler(CAS cas)
cas
parameter.
Warning: for efficiency reasons, the deserializer does not do much type checking for features and their values. It is expected that the incoming XCAS conforms to the type system provided. If it doesn't, the results are undefined.
cas
- This CAS will be used to hold the data of the serialized XCAS.DefaultHandler
to pass to the SAX parser.public DefaultHandler getXCASHandler(CAS cas, org.apache.uima.cas.impl.OutOfTypeSystemData outOfTypeSystemData)
cas
parameter. This
version causes the deserializer to store out-of-typesystem data for later use. (APL)
Warning: for efficiency reasons, the deserializer does not do much type checking for features and their values. It is expected that the incoming XCAS conforms to the type system provided. If it doesn't, the results are undefined.
cas
- This CAS will be used to hold the data of the serialized XCAS.outOfTypeSystemData
- An object that stores FSs that do not conform to the CAS's type systemDefaultHandler
to pass to the SAX parser.public String getDocumentTypeName()
public void setDocumentTypeName(String aDocTypeName)
XCASSerializer.DEFAULT_DOC_TYPE_NAME
.aDocTypeName
- the document type namepublic static void deserialize(InputStream aStream, CAS aCAS) throws SAXException, IOException
deserialize(InputStream,CAS,boolean)
to turn on lenient mode and
ignore any unknown types.aStream
- input stream from which to read the XCAS XML documentaCAS
- CAS into which to deserialize. This CAS must be set up with a type system that is
compatible with that in the XCASSAXException
- if an XML Parsing error occursIOException
- if an I/O failure occurspublic static void deserialize(InputStream aStream, CAS aCAS, boolean aLenient) throws SAXException, IOException
aStream
- input stream from which to read the XCAS XML documentaCAS
- CAS into which to deserialize. This CAS must be set up with a type system that is
compatible with that in the XCAS.aLenient
- if true, unknown Types will be ignored. If false, unknown Types will cause an
exception. The default is false.SAXException
- if an XML Parsing error occursIOException
- if an I/O failure occursCopyright © 2006–2017 The Apache Software Foundation. All rights reserved.