8 def initialize(string = "")
13 def sysseek(offset, whence = IO::SEEK_SET)
15 when IO::SEEK_SET then offset
16 when IO::SEEK_CUR then @pos + offset
17 when IO::SEEK_END then @string.length + offset
22 # @string.nil? || @string.empty?
26 @string[@pos,1] = char.respond_to?(:chr) ? char.chr : char[0,0]
28 @pos %= @string.length
34 string.each_byte do |byte|
40 raise IOError if @string.length < length
41 if length <= @string.length - @pos
42 out = @string[@pos,length]
44 @pos %= @string.length
47 out = @string[@pos..-1]
49 out << @string[0,length-out.length]
55 # raise IOError, "closed stream" if closed?
58 alias close_read close
59 alias close_write close