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; }
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; }
@JRubyMethod(name = "params", required = 2) public IRubyObject params(ThreadContext context, IRubyObject level, IRubyObject strategy) { int l = RubyNumeric.fix2int(level); checkLevel(getRuntime(), l); int s = RubyNumeric.fix2int(strategy); checkStrategy(getRuntime(), s); if (flater.next_out == null) flater.setOutput(new byte[0]); int err = flater.params(l, s); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } if (collectedIdx != flater.next_out_index) collectedIdx = flater.next_out_index; run(); return getRuntime().getNil(); }
@JRubyMethod(name = "params", required = 2) public IRubyObject params(ThreadContext context, IRubyObject level, IRubyObject strategy) { int l = RubyNumeric.fix2int(level); checkLevel(getRuntime(), l); int s = RubyNumeric.fix2int(strategy); checkStrategy(getRuntime(), s); if (flater.next_out == null) flater.setOutput(ByteList.NULL_ARRAY); int err = flater.params(l, s); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } if (collectedIdx != flater.next_out_index) collectedIdx = flater.next_out_index; run(); return getRuntime().getNil(); }
@JRubyMethod(name = "params", required = 2) public IRubyObject params(ThreadContext context, IRubyObject level, IRubyObject strategy) { int l = RubyNumeric.fix2int(level); checkLevel(getRuntime(), l); int s = RubyNumeric.fix2int(strategy); checkStrategy(getRuntime(), s); if (flater.next_out == null) flater.setOutput(ByteList.NULL_ARRAY); int err = flater.params(l, s); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } if (collectedIdx != flater.next_out_index) collectedIdx = flater.next_out_index; run(); return getRuntime().getNil(); }
@JRubyMethod(name = "params", required = 2) public IRubyObject params(ThreadContext context, IRubyObject level, IRubyObject strategy) { int l = RubyNumeric.fix2int(level); checkLevel(getRuntime(), l); int s = RubyNumeric.fix2int(strategy); checkStrategy(getRuntime(), s); if (flater.next_out == null) flater.setOutput(new byte[0]); int err = flater.params(l, s); if (err == com.jcraft.jzlib.JZlib.Z_STREAM_ERROR) { throw RubyZlib.newStreamError(getRuntime(), "stream error"); } if (collectedIdx != flater.next_out_index) collectedIdx = flater.next_out_index; run(); return getRuntime().getNil(); }