Methods for output stream and tests for them.