Fix bad cast.

Signed-off-by: Timo Kinnunen <timo.kinnunen@gmail.com>
Move convenience methods to individual streams.

Signed-off-by: Timo Kinnunen <timo.kinnunen@gmail.com>