- adler
- avail_in
- avail_out
- avail_out=
- close
- closed?
- data_type
- end
- ended?
- finish
- finished?
- flush_next_in
- flush_next_out
- new
- reset
- stream_end?
- total_in
- total_out
[ show source ]
# File lib/zliby.rb, line 54 def initialize @input_buffer = [] @output_buffer = [] @out_pos = -1 @in_pos = -1 @bit_bucket = 0 @bit_count = 0 end
Returns the adler-32 checksum of the input data.
[ show source ]
# File lib/zliby.rb, line 64 def adler end
Returns the number of bytes read. Normally 0 since all bytes are read at once.
[ show source ]
# File lib/zliby.rb, line 68 def avail_in @input_buffer.length - @in_pos end
Returns number of free bytes in the output buffer. As the output buffer is self expanding this normally returns 0.
[ show source ]
# File lib/zliby.rb, line 73 def avail_out @output_buffer.length - @out_pos end
Allocates size bytes in output buffer. If size < avail_out it truncates the buffer.
[ show source ]
# File lib/zliby.rb, line 78 def avail_out= size size.times do if size > avail_out @output_buffer.push nil else @output_buffer.pop end end end
Closes stream. Further operations will raise Zlib::StreamError
[ show source ]
# File lib/zliby.rb, line 89 def close @closed = true end
True if stream closed, otherwise False.
[ show source ]
# File lib/zliby.rb, line 94 def closed? @closed end
Best guess of input data, one of Zlib::BINARY, Zlib::ASCII, or Zlib::UNKNOWN
[ show source ]
# File lib/zliby.rb, line 99 def data_type end
Finishes the stream, flushes output buffer, implemented by child classes
[ show source ]
# File lib/zliby.rb, line 113 def finish close end
True if stream is finished, otherwise False
[ show source ]
# File lib/zliby.rb, line 118 def finished? if @finished.nil? then false else @finished end end
Flushes input buffer and returns the data therein.
[ show source ]
# File lib/zliby.rb, line 127 def flush_next_in @in_pos = @input_buffer.length @finished = true ret = @input_buffer.pack("c*") @input_buffer = [] ret end
Flushes the output buffer and returns all the data
[ show source ]
# File lib/zliby.rb, line 136 def flush_next_out @out_pos = @output_buffer.length @finished = true ret = @output_buffer.pack("c*") @output_buffer = [] ret end
Reset stream. Input and Output buffers are reset.
[ show source ]
# File lib/zliby.rb, line 145 def reset @out_pos = -1 @in_pos = -1 @input_buffer = [] @output_buffer = [] end
See finished.
[ show source ]
# File lib/zliby.rb, line 153 def stream_end? finished? end
Size of input buffer.
[ show source ]
# File lib/zliby.rb, line 158 def total_in @input_buffer.length end
Size of output buffer.
[ show source ]
# File lib/zliby.rb, line 163 def total_out @output_buffer.length end