/**
 * This class implements a number of UNIX like applications.
 *
 * @author fpereira
 *
 */
public class FileCopier2 {

  /**
   * This method copies the contents of an input file into an output file.
   *
   * @param in
   *        the input channel from where data will be read.
   * @param out
   *        the output channel into which data will be written.
   * @throws Exception
   *         In case something goes wrong.
   * @param <E>
   *        The type of the data that is read.
   */
  public final <E> void cp(final InChannel<E> in, final OutChannel<E> out)
      throws Exception {
    while (in.hasData()) {
      out.write(in.read());
    }
  }

}
