示例#1
0
 @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);
 }
示例#2
0
 @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);
 }
示例#3
0
 @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);
 }
示例#4
0
 protected void internalClose() {
   defl.close();
 }
示例#5
0
 protected int internalTotalIn() {
   return defl.getDeflater().getTotalIn();
 }
示例#6
0
 protected IRubyObject internalFinish() throws Exception {
   return defl.finish();
 }
示例#7
0
 protected int internalAdler() {
   return defl.getDeflater().getAdler();
 }
示例#8
0
 protected void internalReset() {
   defl.getDeflater().reset();
 }
示例#9
0
 protected void internalEnd() {
   defl.getDeflater().end();
 }
示例#10
0
 protected boolean internalStreamEndP() {
   return defl.getDeflater().finished();
 }
示例#11
0
 @JRubyMethod(name = "set_dictionary", required = 1)
 public IRubyObject set_dictionary(IRubyObject arg) throws Exception {
   return defl.set_dictionary(arg);
 }
示例#12
0
 @JRubyMethod(name = "params", required = 2)
 public IRubyObject params(IRubyObject level, IRubyObject strategy) {
   defl.params(RubyNumeric.fix2int(level), RubyNumeric.fix2int(strategy));
   return getRuntime().getNil();
 }
示例#13
0
 @JRubyMethod(name = "<<", required = 1)
 public IRubyObject append(IRubyObject arg) throws Exception {
   defl.append(arg);
   return this;
 }