class BinaryStringIO
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.
Public Class Methods
new(*args)
click to toggle source
Creates a new instance of this class.
This takes all the arguments of StringIO.new.
Calls superclass method
# 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) @encoding_locked = false set_encoding('binary') end end
Public Instance Methods
set_encoding(*args)
click to toggle source
Raise an exception on attempts to change the encoding.
Calls superclass method
# File lib/archive/support/binary_stringio.rb, line 24 def set_encoding(*args) raise 'Changing encoding is not allowed' if @encoding_locked @encoding_locked = true super end