/** * Writes the given model to the given {@link OutputStream}. * * This methods does not closes the provided stream. * * @param model the model to be written * @param out the stream the model should be written to * * @throws IOException * @throws IllegalArgumentException in case one of the parameters is null */ public static void writeModel(MaxentModel model, final OutputStream out) throws IOException, IllegalArgumentException { Objects.requireNonNull(model, "model parameter must not be null"); Objects.requireNonNull(out, "out parameter must not be null"); GenericModelWriter modelWriter = new GenericModelWriter((AbstractModel) model, new DataOutputStream(new OutputStream() { @Override public void write(int b) throws IOException { out.write(b); } })); modelWriter.persist(); }
public GenericModelWriter(AbstractModel model, DataOutputStream dos) { init(model, dos); }
GenericModelWriter modelWriter = new GenericModelWriter(trainedModel, new DataOutputStream(modelBytes)); modelWriter.persist(); modelWriter.close();
/** * Writes the given model to the given {@link OutputStream}. * * This methods does not closes the provided stream. * * @param model the model to be written * @param out the stream the model should be written to * * @throws IOException * @throws IllegalArgumentException in case one of the parameters is null */ public static void writeModel(MaxentModel model, final OutputStream out) throws IOException, IllegalArgumentException { Objects.requireNonNull(model, "model parameter must not be null"); Objects.requireNonNull(out, "out parameter must not be null"); GenericModelWriter modelWriter = new GenericModelWriter((AbstractModel) model, new DataOutputStream(new OutputStream() { @Override public void write(int b) throws IOException { out.write(b); } })); modelWriter.persist(); }
public GenericModelWriter(AbstractModel model, File file) throws IOException { String filename = file.getName(); OutputStream os; // handle the zipped/not zipped distinction if (filename.endsWith(".gz")) { os = new GZIPOutputStream(new FileOutputStream(file)); filename = filename.substring(0, filename.length() - 3); } else { os = new FileOutputStream(file); } init(model, new DataOutputStream(os)); }
/** * Writes the given model to the given {@link OutputStream}. * * This methods does not closes the provided stream. * * @param model the model to be written * @param out the stream the model should be written to * * @throws IOException * @throws IllegalArgumentException in case one of the parameters is null */ public static void writeModel(MaxentModel model, final OutputStream out) throws IOException, IllegalArgumentException { Objects.requireNonNull(model, "model parameter must not be null"); Objects.requireNonNull(out, "out parameter must not be null"); GenericModelWriter modelWriter = new GenericModelWriter((AbstractModel) model, new EncryptedDataOutputStream(new OutputStream() { @Override public void write(int b) throws IOException { out.write(b); } })); modelWriter.persist(); }
public GenericModelWriter(AbstractModel model, EncryptedDataOutputStream dos) { init(model, dos); }
public GenericModelWriter(AbstractModel model, DataOutputStream dos) { init(model, dos); }
public GenericModelWriter(AbstractModel model, File file) throws IOException { String filename = file.getName(); OutputStream os; // handle the zipped/not zipped distinction if (filename.endsWith(".gz")) { os = new GZIPOutputStream(new FileOutputStream(file)); filename = filename.substring(0, filename.length() - 3); } else { os = new FileOutputStream(file); } init(model, new DataOutputStream(os)); }
public GenericModelWriter(AbstractModel model, File file) throws IOException { String filename = file.getName(); OutputStream os; // handle the zipped/not zipped distinction if (filename.endsWith(".gz")) { os = new GZIPOutputStream(new FileOutputStream(file)); filename = filename.substring(0, filename.length() - 3); } else { os = new FileOutputStream(file); } init(model, new EncryptedDataOutputStream(os)); }