FileDocCategorySizeDatePackage
FileCopier.javaAPI DocExample841Fri Feb 03 14:50:28 GMT 2006None

FileCopier

public class FileCopier extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidcopy(java.lang.String inFile, java.lang.String outFile)


    FileInputStream  fin = null;
    FileOutputStream fout = null;
    
    try {
      fin  = new FileInputStream(inFile);
      fout = new FileOutputStream(outFile);
      StreamCopier.copy(fin, fout);
    }
    finally {
      try {
        if (fin != null) fin.close();
      }
      catch (IOException ex) {
      }
      try {
        if (fout != null) fout.close();
       }
      catch (IOException ex) { }
    }
  
public static voidmain(java.lang.String[] args)


    if (args.length != 2) {
      System.err.println("Usage: java FileCopier infile outfile");
    }
    try {
      copy(args[0], args[1]);
    }
    catch (IOException ex) {
      System.err.println(ex);
    }