/** * Serializes a CAS in the given format. * * @param jcas * CAS (Common Analysis System) to be serialized. * @param type * type of cTAKES (UIMA) serializer used to write CAS. * @param prettyPrint * {@code true} to do pretty printing of output. * @param stream * {@link OutputStream} object used to print out information * extracted by using cTAKES. * @throws SAXException * if there was a SAX exception. * @throws IOException * if any I/O error occurs. */ public static void serialize(JCas jcas, CTAKESSerializer type, boolean prettyPrint, OutputStream stream) throws SAXException, IOException { if (type == CTAKESSerializer.XCAS) { XCASSerializer.serialize(jcas.getCas(), stream, prettyPrint); } else if (type == CTAKESSerializer.XMI) { XmiCasSerializer.serialize(jcas.getCas(), jcas.getTypeSystem(), stream, prettyPrint, new XmiSerializationSharedData()); } else { XmlCasSerializer.serialize(jcas.getCas(), jcas.getTypeSystem(), stream); } }
protected CAS deserialize(String aSerializedCAS, CAS aCAS) throws Exception { XmiSerializationSharedData deserSharedData = new XmiSerializationSharedData(); uimaSerializer.deserializeCasFromXmi(aSerializedCAS, aCAS, deserSharedData, true, -1); return aCAS; }
protected String serializeCAS(CAS aCAS) throws Exception { XmiSerializationSharedData serSharedData = new XmiSerializationSharedData(); return uimaSerializer.serializeCasToXmi(aCAS, serSharedData); }
private void deserialize(String xmi, CAS cas, String casReferenceId) throws Exception { CacheEntry entry = getController().getInProcessCache().getCacheEntryForCAS(casReferenceId); // Processing the reply from a standard, non-parallel delegate XmiSerializationSharedData deserSharedData; deserSharedData = entry.getDeserSharedData(); if (deserSharedData == null) { deserSharedData = new XmiSerializationSharedData(); entry.setXmiSerializationData(deserSharedData); } UimaSerializer uimaSerializer = SerializerCache.lookupSerializerByThreadId(); uimaSerializer.deserializeCasFromXmi(xmi, cas, deserSharedData, true, -1); }
/** * Serializes a CAS in the given format. * * @param jcas * CAS (Common Analysis System) to be serialized. * @param type * type of cTAKES (UIMA) serializer used to write CAS. * @param prettyPrint * {@code true} to do pretty printing of output. * @param stream * {@link OutputStream} object used to print out information * extracted by using cTAKES. * @throws SAXException * if there was a SAX exception. * @throws IOException * if any I/O error occurs. */ public static void serialize(JCas jcas, CTAKESSerializer type, boolean prettyPrint, OutputStream stream) throws SAXException, IOException { if (type == CTAKESSerializer.XCAS) { XCASSerializer.serialize(jcas.getCas(), stream, prettyPrint); } else if (type == CTAKESSerializer.XMI) { XmiCasSerializer.serialize(jcas.getCas(), jcas.getTypeSystem(), stream, prettyPrint, new XmiSerializationSharedData()); } else { XmlCasSerializer.serialize(jcas.getCas(), jcas.getTypeSystem(), stream); } }
/** * Serializes a CAS in the given format. * * @param jcas * CAS (Common Analysis System) to be serialized. * @param type * type of cTAKES (UIMA) serializer used to write CAS. * @param prettyPrint * {@code true} to do pretty printing of output. * @param stream * {@see OutputStream} object used to print out information * extracted by using cTAKES. * @throws SAXException * if there was a SAX exception. * @throws IOException * if any I/O error occurs. */ public static void serialize(JCas jcas, CTAKESSerializer type, boolean prettyPrint, OutputStream stream) throws SAXException, IOException { if (type == CTAKESSerializer.XCAS) { XCASSerializer.serialize(jcas.getCas(), stream, prettyPrint); } else if (type == CTAKESSerializer.XMI) { XmiCasSerializer.serialize(jcas.getCas(), jcas.getTypeSystem(), stream, prettyPrint, new XmiSerializationSharedData()); } else { XmlCasSerializer.serialize(jcas.getCas(), jcas.getTypeSystem(), stream); } }
this.lenient = lenient; this.sharedData = sharedData != null ? sharedData : new XmiSerializationSharedData(); this.mergePoint = mergePoint; this.allowPreexistingFS = allowPreexistingFS;
switch (serialFormat) { case XMI: XmiSerializationSharedData serSharedData = new XmiSerializationSharedData(); String serializedCAS = serializeCAS(aCAS, serSharedData); msg.put(AsynchAEMessage.CAS, serializedCAS);
deserSharedData = new XmiSerializationSharedData(); uimaSerializer.deserializeCasFromXmi(xmi, cas, deserSharedData, true, -1); break;