Class: Ccrypto::Java::Decompression
- Inherits:
-
Object
- Object
- Ccrypto::Java::Decompression
show all
- Includes:
- DataConversion, TR::CondUtils
- Defined in:
- lib/ccrypto/java/engines/decompression_engine.rb
Instance Method Summary
collapse
#from_b64, #from_b64_mime, #from_hex, included, #logger, #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.
10
11
12
13
14
15
16
|
# File 'lib/ccrypto/java/engines/decompression_engine.rb', line 10
def initialize(*args,&block)
@eng = java.util.zip.Inflater.new
@os = java.io.ByteArrayOutputStream.new
end
|
Instance Method Details
#final ⇒ Object
40
41
|
# File 'lib/ccrypto/java/engines/decompression_engine.rb', line 40
def final
end
|
#teLogger ⇒ Object
43
44
45
|
# File 'lib/ccrypto/java/engines/decompression_engine.rb', line 43
def teLogger
Java.logger(:decomp_eng)
end
|
#update(val) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/ccrypto/java/engines/decompression_engine.rb', line 18
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[READ_BUF_SIZE].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
|