public class CopyFile { public static void main(String[] args) throws IOException { transferTo(args[0], args[1]); } static void transferTo(String source, String copy) throws IOException { byte[] buffer = new byte[1000]; try (InputStream input = new FileInputStream(source);OutputStream output = new FileOutputStream(copy);) { int n; while ((n = input.read(buffer)) != -1) { output.write(buffer, 0, n); } } } }
Sign in to make a reply
好先生的菜