Java Code Examples for org.apache.uima.cas.impl.Serialization#serializeWithCompression()

The following examples show how to use org.apache.uima.cas.impl.Serialization#serializeWithCompression() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SCAS.java    From ambiverse-nlu with Apache License 2.0 5 votes vote down vote up
public void write(DataOutput dataOutput) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Serialization.serializeWithCompression(this.cas, baos);

    dataOutput.writeInt(baos.size());
    dataOutput.write(baos.toByteArray());
}
 
Example 2
Source File: RabbitWriter.java    From bluima with Apache License 2.0 5 votes vote down vote up
public static byte[] serialize(CAS cas) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bos);
    Serialization.serializeWithCompression(cas, out);
    out.close();
    return bos.toByteArray();
}
 
Example 3
Source File: SCAS.java    From ambiverse-nlu with Apache License 2.0 4 votes vote down vote up
public byte[] serialize() throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Serialization.serializeWithCompression(this.cas, baos);

    return baos.toByteArray();
}