use nio functions for copying streams