Created
August 17, 2015 00:31
-
-
Save fpereira1/a43e39249e56f2e3466c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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