Adding flush method to streams