Skip to content

Instantly share code, notes, and snippets.

@sonOfRa
Created March 5, 2020 09:31
Show Gist options
  • Save sonOfRa/8165c904b9a1360ed09a34017ba80d7e to your computer and use it in GitHub Desktop.
Save sonOfRa/8165c904b9a1360ed09a34017ba80d7e to your computer and use it in GitHub Desktop.
public void execute() {
File srcFile = new File(this.srcPath);
File destFile = new File(this.destPath);
try (InputStream inputStream = new FileInputStream(srcFile);
OutputStream outputStream = new FileOutputStream(destFile)){​
byte[] buffer = new byte[8192];
int length = 0;
while ((length = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, length);
}
} catch (IOException ex) {
Logger.getLogger(NWCp.class.getName()).log(Level.SEVERE, null, ex);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment