Copying a File

import java.nio.filesystems.*;
import java.io.*;

public class FileCopier {

  public static void main(String[] args) throws IOException {

    if (args.length != 2) {
      System.err.println("Usage: java FileCopier infile outfile");
      return;
    }

    PathReference source = PathReference.from(args[0]);
    PathReference target = PathReference.from(args[1]);

    int flags = CopyFlag.COPY_ATTRIBUTES | CopyFlag.REPLACE_EXISTING;
    source.copyTo(target, flags);

  }

}