Class: BinaryStringIO

Inherits:
StringIO
  • Object
show all
Defined in:
lib/archive/support/binary_stringio.rb

Overview

This class is a version of StringIO that always uses the binary encoding on any Ruby platform that has a notion of encodings. On Ruby platforms without encoding support, this class is equivalent to StringIO.

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ BinaryStringIO

Creates a new instance of this class.

This takes all the arguments of StringIO.new.


12
13
14
15
16
17
18
19
# File 'lib/archive/support/binary_stringio.rb', line 12

def initialize(*args)
  super

  # Force a binary encoding when possible.
  if respond_to?(:set_encoding, true)
    set_encoding('binary')
  end
end