Misc functions on streams.