Class RFuzz::PushBackIO
In: lib/rfuzz/pushbackio.rb
Parent: Object

A simple class that using a StringIO object internally to allow for faster and simpler "push back" semantics. It basically lets you read a random amount from a secondary IO object, parse what is needed, and then anything remaining can be quickly pushed back in one chunk for the next read.

Methods

close   flush   new   pop   protect   push   random_death   read   reset   write  

Attributes

secondary  [RW] 

Public Class methods

Public Instance methods

Pushes the given string content back onto the stream for the next read to handle.

First does a read from the internal buffer, and then appends anything needed from the secondary IO to complete the request. The return value is guaranteed to be a String, and never nil. If it returns a string of length 0 then there is nothing to read from the buffer (most likely closed). It will also avoid reading from a secondary that’s closed.

If partial==true then readpartial is used instead.

[Validate]