@@ -0,0 +1,1416 @@
+package com.github.megallo.markoverator.kryo.utils;%0A%0Aimport com.esotericsoftware.kryo.Kryo;%0Aimport com.esotericsoftware.kryo.io.Input;%0Aimport com.esotericsoftware.kryo.io.Output;%0Aimport com.github.megallo.markoverator.bigrammer.BigramModel;%0A%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0A%0Apublic class KryoModelUtils %7B%0A%0A    /**%0A     * Write out the model object to a stream, e.g. a file on disk%0A     * @param model a BigramModel object, like the one built by buildModel()%0A     * @param outputStream a writeable stream, such as java.io.FileOutputStream%0A     */%0A    public static void saveModel(BigramModel model, OutputStream outputStream) %7B%0A        if (model == null) %7B%0A            throw new RuntimeException(%22Refusing to write empty model.%22);%0A        %7D%0A        Kryo kryo = new Kryo();%0A        Output output = new Output(outputStream);%0A        kryo.writeObject(output, model);%0A        output.close();%0A    %7D%0A%0A    /**%0A     * Load a model object from a stream, e.g. a file on disk%0A     * @param inputStream readable stream we can read a previously built model from%0A     * @return a BigramModel that's ready to load into Bigrammer%0A     */%0A    public static BigramModel loadModel(InputStream inputStream) %7B%0A        Kryo kryo = new Kryo();%0A        Input input = new Input(inputStream);%0A        BigramModel model = kryo.readObject(input, BigramModel.class);%0A        input.close();%0A%0A        return model;%0A    %7D%0A%7D%0A

Move kryo serialization code to markoverator-kryo in KryoModelUtils