# File lib/rhc/vendor/zliby.rb, line 57 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.
# File lib/rhc/vendor/zliby.rb, line 67 def adler end
Returns the number of bytes read. Normally 0 since all bytes are read at once.
# File lib/rhc/vendor/zliby.rb, line 71 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.
# File lib/rhc/vendor/zliby.rb, line 76 def avail_out @output_buffer.length - @out_pos end
Allocates size bytes in output buffer. If size < #avail_out it truncates the buffer.
# File lib/rhc/vendor/zliby.rb, line 81 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
# File lib/rhc/vendor/zliby.rb, line 92 def close @closed = true end
True if stream closed, otherwise False.
# File lib/rhc/vendor/zliby.rb, line 97 def closed? @closed end
Best guess of input data, one of Zlib::BINARY, Zlib::ASCII, or Zlib::UNKNOWN
# File lib/rhc/vendor/zliby.rb, line 102 def data_type end
See close
# File lib/rhc/vendor/zliby.rb, line 106 def end close end
See closed?
# File lib/rhc/vendor/zliby.rb, line 111 def ended? closed? end
Finishes the stream, flushes output buffer, implemented by child classes
# File lib/rhc/vendor/zliby.rb, line 116 def finish close end
True if stream is finished, otherwise False
# File lib/rhc/vendor/zliby.rb, line 121 def finished? if @finished.nil? then false else @finished end end
Flushes input buffer and returns the data therein.
# File lib/rhc/vendor/zliby.rb, line 130 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
# File lib/rhc/vendor/zliby.rb, line 139 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.
# File lib/rhc/vendor/zliby.rb, line 148 def reset @out_pos = -1 @in_pos = -1 @input_buffer = [] @output_buffer = [] end
See finished.
# File lib/rhc/vendor/zliby.rb, line 156 def stream_end? finished? end
Size of input buffer.
# File lib/rhc/vendor/zliby.rb, line 161 def total_in @input_buffer.length end
Size of output buffer.
# File lib/rhc/vendor/zliby.rb, line 166 def total_out @output_buffer.length end