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(); }
public static void deserialize(CAS cas, byte[] byteArray) throws IOException, ClassNotFoundException { ByteArrayInputStream bis = new ByteArrayInputStream(byteArray); ObjectInputStream in = new ObjectInputStream(bis); Serialization.deserializeCAS(cas, in); in.close(); }