Class: Ronin::Support::Compression::Gzip::Reader

Inherits:
Zlib::GzipReader
  • Object
show all
Defined in:
lib/ronin/support/compression/gzip/reader.rb

Overview

Handles reading gzip compressed data.

Instance Method Summary collapse

Constructor Details

#initialize(io_or_buffer, mode: 'r') ⇒ Reader

Initializes the gzip writer.

Examples:

Initializing with an IO object:

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

Initializing with a buffer:

buffer = "..."
gzip   = Compression::Gzip::Reader.new(buffer)

Parameters:

  • io_or_buffer (IO, StringIO, String)

    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.

  • mode (String) (defaults to: 'r')

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

Since:

  • 1.0.0



57
58
59
60
61
62
63
64
# 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