/** * 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(); }
GenericModelWriter modelWriter = new GenericModelWriter(trainedModel, new DataOutputStream(modelBytes)); modelWriter.persist();
/** * 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(); }
/** * 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(); }