@JRubyMethod(name = "deflate", required = 1, optional = 1) public IRubyObject deflate(IRubyObject[] args) throws Exception { args = Arity.scanArgs(getRuntime(), args, 1, 1); int flush = 0; // NO_FLUSH if (!args[1].isNil()) { flush = RubyNumeric.fix2int(args[1]); } return defl.deflate(args[0].convertToString().getByteList(), flush); }
@JRubyMethod(name = "deflate", required = 1, optional = 1, meta = true) public static IRubyObject s_deflate(IRubyObject recv, IRubyObject[] args) throws Exception { args = Arity.scanArgs(recv.getRuntime(), args, 1, 1); int level = -1; if (!args[1].isNil()) { level = RubyNumeric.fix2int(args[1]); } return ZlibDeflate.s_deflate(recv, args[0].convertToString().getByteList(), level); }
@JRubyMethod(name = "flush", optional = 1) public IRubyObject flush(IRubyObject[] args) throws Exception { int flush = 2; // SYNC_FLUSH if (args.length == 1) { if (!args[0].isNil()) { flush = RubyNumeric.fix2int(args[0]); } } return defl.flush(flush); }
protected void internalClose() { defl.close(); }
protected int internalTotalIn() { return defl.getDeflater().getTotalIn(); }
protected IRubyObject internalFinish() throws Exception { return defl.finish(); }
protected int internalAdler() { return defl.getDeflater().getAdler(); }
protected void internalReset() { defl.getDeflater().reset(); }
protected void internalEnd() { defl.getDeflater().end(); }
protected boolean internalStreamEndP() { return defl.getDeflater().finished(); }
@JRubyMethod(name = "set_dictionary", required = 1) public IRubyObject set_dictionary(IRubyObject arg) throws Exception { return defl.set_dictionary(arg); }
@JRubyMethod(name = "params", required = 2) public IRubyObject params(IRubyObject level, IRubyObject strategy) { defl.params(RubyNumeric.fix2int(level), RubyNumeric.fix2int(strategy)); return getRuntime().getNil(); }
@JRubyMethod(name = "<<", required = 1) public IRubyObject append(IRubyObject arg) throws Exception { defl.append(arg); return this; }