Class: Ccrypto::Java::Decompression
- Inherits:
-
Object
- Object
- Ccrypto::Java::Decompression
- Includes:
- DataConversion, TR::CondUtils, TeLogger::TeLogHelper
- Defined in:
- lib/ccrypto/java/engines/decompression_engine.rb
Instance Method Summary collapse
- #final ⇒ Object
-
#initialize(*args, &block) ⇒ Decompression
constructor
A new instance of Decompression.
- #update(val) ⇒ Object
Methods included from DataConversion
#from_b64, #from_hex, included, #to_b64, #to_b64_mime, #to_bin, #to_hex, #to_java_bytes, #to_str
Constructor Details
#initialize(*args, &block) ⇒ Decompression
Returns a new instance of Decompression.
13 14 15 16 17 18 19 |
# File 'lib/ccrypto/java/engines/decompression_engine.rb', line 13 def initialize(*args,&block) @eng = java.util.zip.Inflater.new @os = java.io.ByteArrayOutputStream.new end |
Instance Method Details
#final ⇒ Object
43 44 |
# File 'lib/ccrypto/java/engines/decompression_engine.rb', line 43 def final end |
#update(val) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ccrypto/java/engines/decompression_engine.rb', line 21 def update(val) teLogger.debug "Given #{val.length} bytes for decompression" if val.length > 0 @eng.setInput(to_java_bytes(val)) baos = java.io.ByteArrayOutputStream.new buf = ::Java::byte[102400].new while not @eng.finished done = @eng.inflate(buf) teLogger.debug "Done #{done} bytes" @os.write(buf,0,done) end @os.toByteArray else ::Java::byte[0].new end end |