Пример #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;
 }