Search in sources :

Example 6 with CASCompleteSerializer

use of org.apache.uima.cas.impl.CASCompleteSerializer in project webanno by webanno.

the class CasPersistenceUtils method readSerializedCas.

public static void readSerializedCas(JCas aJCas, File aFile) throws IOException {
    try (ObjectInputStream is = new ObjectInputStream(new FileInputStream(aFile))) {
        CASCompleteSerializer serializer = (CASCompleteSerializer) is.readObject();
        deserializeCASComplete(serializer, aJCas.getCasImpl());
        // Initialize the JCas sub-system which is the most often used API in DKPro Core
        // components
        aJCas.getCas().getJCas();
    } catch (CASException | ClassNotFoundException e) {
        throw new IOException(e);
    }
}
Also used : CASCompleteSerializer(org.apache.uima.cas.impl.CASCompleteSerializer) CASException(org.apache.uima.cas.CASException) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) ObjectInputStream(java.io.ObjectInputStream)

Aggregations

CASCompleteSerializer (org.apache.uima.cas.impl.CASCompleteSerializer)6 IOException (java.io.IOException)3 CASException (org.apache.uima.cas.CASException)3 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 ObjectInputStream (java.io.ObjectInputStream)2 ObjectOutputStream (java.io.ObjectOutputStream)2 Project (de.tudarmstadt.ukp.clarin.webanno.model.Project)1 Sentence (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence)1 Token (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 UIMAException (org.apache.uima.UIMAException)1 CAS (org.apache.uima.cas.CAS)1 TypeSystem (org.apache.uima.cas.TypeSystem)1 JCas (org.apache.uima.jcas.JCas)1 TypeSystemDescription (org.apache.uima.resource.metadata.TypeSystemDescription)1 MDC (org.slf4j.MDC)1