Use common function for stream copying