class Ronin::Support::Compression::Gzip::Reader

Handles reading gzip compressed data.

@see rubydoc.info/stdlib/zlib/Zlib/GzipReader

@api public

@since 1.0.0

Public Class Methods

new(io_or_buffer, mode: 'r') click to toggle source

Initializes the gzip writer.

@param [IO, StringIO, String] io_or_buffer

The IO object or buffer to read from. If a `String` is given, then
it will be wrapped in a `StringIO` object using the optional
`mode` argument.

@param [String] mode

The optional mode to initialize the `StringIO` object to wrap
around the given buffer `String`.

@example Initializing with an IO object:

gzip = Compression::Gzip::Reader.new(io)

@example Initializing with a buffer:

buffer = "..."
gzip   = Compression::Gzip::Reader.new(buffer)
Calls superclass method
# File lib/ronin/support/compression/gzip/reader.rb, line 57
def initialize(io_or_buffer, mode: 'r')
  io = case io_or_buffer
       when String then StringIO.new(io_or_buffer,mode)
       else             io_or_buffer
       end

  super(io)
end