Module: CcipherFactory::Compression::ZlibDecompressor
Instance Method Summary
collapse
#attach_mode, #cleanup_intOutputBuf, #cleanup_intOutputFile, #detach_mode, #disposeOutput, #intOutputBuf, #intOutputFile, #is_attach_mode?, #is_output_given?, #output, #output_obj, #sanitize_symbol, #write_to_output
Instance Method Details
#decompress_final ⇒ Object
56
57
58
|
# File 'lib/ccipher_factory/compression/zlib_decompressor.rb', line 56
def decompress_final
@decompressor.final
end
|
#decompress_init(*args, &block) ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/ccipher_factory/compression/zlib_decompressor.rb', line 9
def decompress_init(*args, &block)
if block
instance_eval(&block)
decompress_final
else
self
end
end
|
#decompress_update(val) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/ccipher_factory/compression/zlib_decompressor.rb', line 43
def decompress_update(val)
if val.length > 0
check_state
begin
res = @decompressor.update(val)
write_to_output(res)
res
rescue Exception => ex
raise DecompressionError, ex
end
end
end
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/ccipher_factory/compression/zlib_decompressor.rb', line 20
def decompress_update_meta(val)
if @decompressor.nil?
begin
intOutputBuf.write(val)
Encoding.(intOutputBuf) do |meta, bal|
ts = BinStruct.instance.struct_from_bin(meta)
case ts.oid
when BTag.constant_value(:compression_zlib)
@decompressor = Ccrypto::UtilFactory.instance(:decompression)
else
raise DecompressionError, "Unknown compression type '#{ts.id}'"
end
decompress_update(bal)
end
rescue Encoding::InsufficientData => e
end
else
decompress_update(val)
end
end
|