Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void copyFileUsingStream(File source, File dest) throws IOException {
- InputStream is = null;
- OutputStream os = null;
- try {
- is = new FileInputStream(source);
- os = new FileOutputStream(dest);
- byte[] buffer = new byte[1024];
- int length;
- while ((length = is.read(buffer)) > 0) {
- os.write(buffer, 0, length);
- }
- } finally {
- is.close();
- os.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment