Split stream.h into smaller units

As reported in issue #37, `stream.h` is splitted in smaller units.