Guest User

Untitled

a guest
Nov 15th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. public class Solution {
  4. public static void main(String[] args) throws IOException
  5. {
  6. int sum = 0;
  7. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  8. String infILE = reader.readLine();
  9. String outfILE = reader.readLine();
  10.  
  11. //String infILE = "K:/data.txt";
  12. //String outfILE = "K:/data2.txt";
  13.  
  14. FileInputStream fileInputStream = new FileInputStream(infILE);
  15. FileOutputStream outputStream = new FileOutputStream(outfILE);
  16.  
  17. byte[] buffer = new byte[0];
  18.  
  19. if (fileInputStream.available() > 0)
  20. {
  21. //читаем весь файл одним куском
  22. buffer = new byte[fileInputStream.available()];
  23. int count = fileInputStream.read(buffer);
  24. }
  25. for (int i = 0; i < buffer.length; i++)
  26. {
  27. outputStream.write(buffer[buffer.length-i-1]);
  28. }
  29.  
  30. outputStream.close();
  31. fileInputStream.close();
  32. }
  33. }
Add Comment
Please, Sign In to add comment