Skip to content

Instantly share code, notes, and snippets.

@fpereira1
Created August 17, 2015 00:31
Show Gist options
  • Save fpereira1/a43e39249e56f2e3466c to your computer and use it in GitHub Desktop.
Save fpereira1/a43e39249e56f2e3466c to your computer and use it in GitHub Desktop.
import java.io.*;
public class CopyFile {
public static void main(String args[]) throws IOException
{
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("input.txt");
out = new FileOutputStream("output.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
}finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment