Module: BinData::IO

Defined in:
lib/bindata/io.rb

Overview

A wrapper around an IO object. The wrapper provides a consistent interface for BinData objects to use when accessing the IO.

Defined Under Namespace

Modules: Common Classes: Read, Write

Class Method Summary collapse

Class Method Details

.create_string_io(str = "") ⇒ Object

Creates a StringIO around str.



215
216
217
218
219
# File 'lib/bindata/io.rb', line 215

def self.create_string_io(str = "")
  s = StringIO.new(str.dup.force_encoding(Encoding::BINARY))
  s.binmode
  s
end