public TDeflater(int level, boolean noHeader) { super(); if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) { throw new IllegalArgumentException(); } compressLevel = level; try { impl = new Deflater(compressLevel, strategy, noHeader); } catch (GZIPException e) { // do nothing } nowrap = noHeader; }
@Override public void init(Mode mode) { try { switch (mode) { case DEFLATE: deflater = new Deflater(JZlib.Z_DEFAULT_COMPRESSION); break; case INFLATE: inflater = new Inflater(); break; default: assert false; } } catch (GZIPException gze) { } }
public DeflaterOutputStream(OutputStream out) throws IOException { this(out, new Deflater(JZlib.Z_DEFAULT_COMPRESSION), DEFAULT_BUFSIZE, true); mydeflater = true; }
public GZIPOutputStream(OutputStream out, int size, boolean close_out) throws IOException { this(out, new Deflater(JZlib.Z_DEFAULT_COMPRESSION, 15+16), size, close_out); mydeflater=true; }
public DeflaterOutputStream(OutputStream out) throws IOException { this(out, new Deflater(JZlib.Z_DEFAULT_COMPRESSION), DEFAULT_BUFSIZE, true); mydeflater = true; }
public DeflaterOutputStream(OutputStream out) throws IOException { this(out, new Deflater(JZlib.Z_DEFAULT_COMPRESSION), DEFAULT_BUFSIZE, true); mydeflater = true; }
public GZIPOutputStream(OutputStream out, int size, boolean close_out) throws IOException { this(out, new Deflater(JZlib.Z_DEFAULT_COMPRESSION, 15+16), size, close_out); mydeflater=true; }
public GZIPOutputStream(OutputStream out, int size, boolean close_out) throws IOException { this(out, new Deflater(JZlib.Z_DEFAULT_COMPRESSION, 15+16), size, close_out); mydeflater=true; }
public ZOutputStream(OutputStream out, int level, boolean nowrap) throws IOException { super(out); this.out=out; Deflater deflater = new Deflater(level, nowrap); dos = new DeflaterOutputStream(out, deflater); compress=true; }
public ZOutputStream(OutputStream out, int level, boolean nowrap) throws IOException { super(out); this.out=out; Deflater deflater = new Deflater(level, nowrap); dos = new DeflaterOutputStream(out, deflater); compress=true; }
public ZInputStream(InputStream in, int level) throws IOException { super(in); this.in=in; deflater = new Deflater(); deflater.init(level); compress=true; }
public ZInputStream(InputStream in, int level) throws IOException { super(in); this.in=in; deflater = new Deflater(); deflater.init(level); compress=true; }
public ZInputStream(InputStream in, int level) throws IOException { super(in); this.in=in; deflater = new Deflater(); deflater.init(level); compress=true; }
public ZOutputStream(OutputStream out, int level, boolean nowrap) throws IOException { super(out); this.out=out; Deflater deflater = new Deflater(level, nowrap); dos = new DeflaterOutputStream(out, deflater); compress=true; }
@Override public void init(Mode mode) { try { switch (mode) { case DEFLATE: deflater = new Deflater(JZlib.Z_DEFAULT_COMPRESSION); break; case INFLATE: inflater = new Inflater(); break; default: assert false; } } catch (GZIPException gze) { } }
private IRubyObject initializeCommon(IRubyObject stream, int level) { realIo = (RubyObject) stream; try { // the 15+16 here is copied from a Deflater default constructor Deflater deflater = new Deflater(level, 15+16, false); io = new GZIPOutputStream(new IOOutputStream(realIo, false, false), deflater, 512, false); return this; } catch (IOException ioe) { throw getRuntime().newIOErrorFromException(ioe); } }
private IRubyObject initializeCommon(IRubyObject stream, int level) { realIo = (RubyObject) stream; try { // the 15+16 here is copied from a Deflater default constructor Deflater deflater = new Deflater(level, 15+16, false); io = new GZIPOutputStream(new IOOutputStream(realIo, false, false), deflater, 512, false); return this; } catch (IOException ioe) { throw getRuntime().newIOErrorFromException(ioe); } }
private void init(int level, int windowBits, int memlevel, int strategy) { flush = JZlib.Z_NO_FLUSH; flater = new com.jcraft.jzlib.Deflater(); // TODO: Can we expect JZlib to check level, windowBits, and strategy here? // Then we should remove checkLevel, checkWindowsBits and checkStrategy. int err = flater.init(level, windowBits, memlevel); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } err = flater.params(level, strategy); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } collected = new byte[BASE_SIZE]; collectedIdx = 0; }
private void init(int level, int windowBits, int memlevel, int strategy) { flush = JZlib.Z_NO_FLUSH; flater = new com.jcraft.jzlib.Deflater(); // TODO: Can we expect JZlib to check level, windowBits, and strategy here? // Then we should remove checkLevel, checkWindowsBits and checkStrategy. int err = flater.init(level, windowBits, memlevel); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } err = flater.params(level, strategy); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } collected = new byte[BASE_SIZE]; collectedIdx = 0; }
private void init(int level, int windowBits, int memlevel, int strategy) { flush = JZlib.Z_NO_FLUSH; flater = new com.jcraft.jzlib.Deflater(); // TODO: Can we expect JZlib to check level, windowBits, and strategy here? // Then we should remove checkLevel, checkWindowsBits and checkStrategy. int err = flater.init(level, windowBits, memlevel); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } err = flater.params(level, strategy); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } collected = new byte[BASE_SIZE]; collectedIdx = 0; }