util.Channels.copyN

Copies a given number of bytes from one base.Channel to another.

Syntax

util.Channels.copyN(
     in base.Channel,
     out base.Channel,
     n INTEGER
 )
RETURNS INTEGER
  1. in is the channel to read from.
  2. out is the channel to write to.
  3. n is the number of bytes to be copied.
  4. Returns the number of bytes copied.

Usage

The util.Channels.copyN() copies data between two base.Channel objects.

If the returned value is less than n, then the source channel has reached EOF.