title: Ruby StringIO for concurrent reading and writing
body: <p>I'm looking for some <a href="http://ruby-doc.org/stdlib-1.9.3/libdoc/stringio/rdoc/StringIO.html" rel="nofollow">StringIO</a>-similar class, that allows me to write and read concurrently from different parts of my program.<br>
  From one part of the program I want to write (append) characters to the buffer, from another part I want to read them.   </p>
  
  <p>The problem with StringIO is the following:  </p>
  
  <pre><code>buffer = StringIO.new
  buffer.write "Foobar"      # Write to the buffer
  buffer.rewind              # Move the pointer to beginning
  buffer.getc                #=&gt; F
  buffer.getc                #=&gt; o
  
  buffer.write("something")  # Write more to the buffer
  buffer.string              #=&gt; Fosomething
  buffer.getc                #=&gt; nil
  buffer.pos                 #=&gt; 11
  </code></pre>
  
  <p>Whenever I write to the buffer, it is written to the current position. Aterwards the position is moved to the last written characters.</p>
  
  <p>What I need is a StringBuffer with two seperate positions for reading and writing, instead of only one. Does something like this exist in ruby or do I have to do in on my own?</p>