/** * Creates a new XZ compressor using the default LZMA2 options. * This is equivalent to <code>XZCompressorOutputStream(outputStream, 6)</code>. * @param outputStream the stream to wrap * @throws IOException on error */ public XZCompressorOutputStream(final OutputStream outputStream) throws IOException { out = new XZOutputStream(outputStream, new LZMA2Options()); }
/** * Creates a new XZ compressor using the specified LZMA2 preset level. * <p> * The presets 0-3 are fast presets with medium compression. * The presets 4-6 are fairly slow presets with high compression. * The default preset is 6. * <p> * The presets 7-9 are like the preset 6 but use bigger dictionaries * and have higher compressor and decompressor memory requirements. * Unless the uncompressed size of the file exceeds 8 MiB, * 16 MiB, or 32 MiB, it is waste of memory to use the * presets 7, 8, or 9, respectively. * @param outputStream the stream to wrap * @param preset the preset * @throws IOException on error */ public XZCompressorOutputStream(final OutputStream outputStream, final int preset) throws IOException { out = new XZOutputStream(outputStream, new LZMA2Options(preset)); }
break; case COMPRESSION_FORMAT_XZ_LZMA2: compressionOut = new XZOutputStream(bufferedOut, new LZMA2Options()); mimeTypeRef = "application/x-xz"; break;
break; case COMPRESSION_FORMAT_XZ_LZMA2: compressionOut = new XZOutputStream(bufferedOut, new LZMA2Options()); mimeTypeRef.set("application/x-xz"); break;
public byte[] saveWeightVectorToByteArray() throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(new XZOutputStream(new BufferedOutputStream(bos), new LZMA2Options())); oos.writeObject(w_vector); oos.close(); return bos.toByteArray(); }
static public XZOutputStream createXZBufferedOutputStream(String filename, int preset) { XZOutputStream zout = null; try { zout = new XZOutputStream(new BufferedOutputStream(new FileOutputStream(filename)), new LZMA2Options(preset)); } catch (IOException e) {e.printStackTrace();} return zout; }
static public XZOutputStream createXZBufferedOutputStream(String filename) { XZOutputStream zout = null; try { zout = new XZOutputStream(new BufferedOutputStream(new FileOutputStream(filename)), new LZMA2Options()); } catch (IOException e) {e.printStackTrace();} return zout; }
static public XZOutputStream createXZBufferedOutputStream(String filename, int preset) { XZOutputStream zout = null; try { zout = new XZOutputStream(new BufferedOutputStream(new FileOutputStream(filename)), new LZMA2Options(preset)); } catch (IOException e) {e.printStackTrace();} return zout; }
@Override public Optional<OutputStream> getOutputStream() { try { BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( new FileOutputStream(out)); outputStream = new XZOutputStream(bufferedOutputStream, filterOptions); } catch (IOException e) { LOGGER.error("Cannot create output stream", e); return emptyOptional(); } return optional(outputStream); }
public void saveModel(AbstractStatisticalComponent<?,?,?,?,?> component, String modelPath) { ObjectOutputStream out; try { out = new ObjectOutputStream(new XZOutputStream(new BufferedOutputStream(new FileOutputStream(modelPath)), new LZMA2Options())); component.save(out); out.close(); } catch (Exception e) {e.printStackTrace();} }
public void saveModel(AbstractStatisticalComponent<?,?,?,?,?> component, String modelPath) { ObjectOutputStream out; try { out = new ObjectOutputStream(new XZOutputStream(new BufferedOutputStream(new FileOutputStream(modelPath)), new LZMA2Options())); component.save(out); out.close(); } catch (Exception e) {e.printStackTrace();} }
@Override public Optional<OutputStream> getOutputStream() { try { BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( new FileOutputStream(out)); outputStream = new XZOutputStream(bufferedOutputStream, filterOptions); } catch (IOException e) { LOGGER.error("Cannot create output stream", e); return emptyOptional(); } return optional(outputStream); }
public byte[] modelsToByteArray() throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(new XZOutputStream(new BufferedOutputStream(bos), new LZMA2Options())); for (StringModel model : s_models) model.save(oos); oos.close(); return bos.toByteArray(); }
public byte[] modelsToByteArray() throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(new XZOutputStream(new BufferedOutputStream(bos), new LZMA2Options())); for (StringModel model : s_models) model.save(oos); oos.close(); return bos.toByteArray(); }
static public XZOutputStream createXZBufferedOutputStream(OutputStream out, int preset) { XZOutputStream zout = null; try { zout = new XZOutputStream(new BufferedOutputStream(out), new LZMA2Options(preset)); } catch (IOException e) {e.printStackTrace();} return zout; }
static public XZOutputStream createXZBufferedOutputStream(OutputStream out) { XZOutputStream zout = null; try { zout = new XZOutputStream(new BufferedOutputStream(out), new LZMA2Options()); } catch (IOException e) {e.printStackTrace();} return zout; }
/** * Creates a new XZ compressor using the default LZMA2 options. * This is equivalent to <code>XZCompressorOutputStream(outputStream, 6)</code>. * @param outputStream the stream to wrap * @throws IOException on error */ public XZCompressorOutputStream(final OutputStream outputStream) throws IOException { out = new XZOutputStream(outputStream, new LZMA2Options()); }
@Override public Optional<OutputStream> getOutputStream() { if (xzOutputStream == null) { try { xzOutputStream = new XZOutputStream(outputStream, filterOptions); } catch (IOException e) { LOGGER.error("Fille cannot be found or opened", e); return emptyOptional(); } } return optional(verifyNotNull(xzOutputStream)); }
@Override public Optional<OutputStream> getOutputStream() { if (xzOutputStream == null) { try { xzOutputStream = new XZOutputStream(outputStream, filterOptions); } catch (IOException e) { LOGGER.error("Fille cannot be found or opened", e); return emptyOptional(); } } return optional(verifyNotNull(xzOutputStream)); }
@Override public Optional<OutputStream> getOutputStream() { if (xzOutputStream == null) { try { xzOutputStream = new XZOutputStream(outputStream, filterOptions); } catch (IOException e) { LOGGER.error("Fille cannot be found or opened", e); return emptyOptional(); } } return optional(verifyNotNull(xzOutputStream)); }