FileDocCategorySizeDatePackage
BufferedFileCopier.javaAPI DocExample650Mon Feb 13 15:03:00 GMT 2006None

BufferedFileCopier

public class BufferedFileCopier extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidcopy(java.io.InputStream in, java.io.OutputStream out)


    BufferedInputStream bin = new BufferedInputStream(in, 1024*1024);
    BufferedOutputStream bout = new BufferedOutputStream(out, 1024*1024);

    while (true) {
      int datum = bin.read();
      if (datum == -1) break;
      bout.write(datum);
    }
    bout.flush();
  
public static voidmain(java.lang.String[] args)


    try {
      copy(new FileInputStream(args[0]), new FileOutputStream(args[1]));
    }
    catch (IOException ex) {
      System.err.println(ex);
    }