Remove duplicate code by using util::copy()

This code is identical to io::util::copy()