drSdGdBy

fileoutputstream into fileinputstream

Feb 21st, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. public static long copy(FileInputStream input, FileOutputStream output) throws IOException
  2. {
  3.   byte[] buffer = new byte[4096];
  4.   long count = 0L;
  5.   int n = 0;
  6.   while (-1 != (n = input.read(buffer))) {
  7.    output.write(buffer, 0, n);
  8.    count += n;
  9.   }
  10.   return count;
  11. }
Add Comment
Please, Sign In to add comment