Make definition of a valid stream more relaxed.

Now the stream need only inherit from EventEmitter and define a write
function.
Simplify RingBuffer.write() implementation.