Add a flush method for output streams