Skip to content

Instantly share code, notes, and snippets.

Created February 26, 2014 01:08
Show Gist options
  • Save anonymous/9221440 to your computer and use it in GitHub Desktop.
Save anonymous/9221440 to your computer and use it in GitHub Desktop.
public void backupFile()
{
DataInputStream in = null;
DataOutputStream out = null;
try {
in = new DataInputStream(new FileInputStream(f1));
out = new DataOutputStream(new FileOutputStream(fBackup));
try {
while (true) {
Byte dataIn = in.readByte();
out.writeByte(dataIn);
}
} catch (IOException e) {
System.out.println("Finished backing up");
// e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
in.close();
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment