A stream represents a stream of bytes, either being read from some source, or written to some destination. Storm provides different streams for different sources and destinations. These all present the same interface, which means that programs typically do not need to be aware of the exact source or destination of the data.

All streams in Storm present a synchronous interface. Utilizing the cheap user level threads in Storm, it is possible to create nonblocking calls by simply spawning a new user level thread (spawn in Basic Storm). Using multiple user level threads in this fashion makes Storm issue nonblocking IO requests to the operating system, so that other user level threads are not blocked by long-running IO requests (this is not the case for disk access on Linux currently due to the POSIX API, but it will be fixed eventually).

There are three types of streams in Storm: output streams, input streams, and random access input streams.

Output Streams

Output streams accept data and writes it to some destination. An output stream is implemented as subclasses to the OStream class. Output streams are not buffered in general, so it is usually a good idea to write data in chunks when possible. The class can be used to wrap an output to ensure data is buffered.

The OStream class has the following members:

Input Streams

An input stream reads data from some source. Input streams are generally not buffered, so it is usually a good idea to read data in chunks. This is done by many consumers of data from input streams, such as the text IO system.

The IStream class has the following members:

Random Access Input Streams

Random access input stream are derived from The class RIStream inherit from IStream, which means that random-access input streams are usable as regular input streams. Random streams provide the following members in addition to regular streams: