Created
February 18, 2022 16:03
-
-
Save oriapp/3f898b4449823e2218da4f82097e7206 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 fileing { | |
public static void main(String[] args) { | |
} | |
void copyFileBuffer(File src, File dest) throws IOException { | |
try (var in = new BufferedInputStream( | |
new FileInputStream(src)); | |
var out = new BufferedOutputStream( | |
new FileOutputStream(dest))) { | |
var buffer = new byte[1024]; | |
int lengthRead; | |
while ((lengthRead = in.read(buffer)) > 0) { | |
out.write(buffer, 0, lengthRead); | |
out.flush(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment