Advertisement
Guest User

zad 2

a guest
Feb 27th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. package lab_1;
  2.  
  3. import java.io.File;
  4. import java.io.FileInputStream;
  5. import java.io.FileOutputStream;
  6. import java.io.IOException;
  7. import java.util.ArrayList;
  8. import java.util.List;
  9.  
  10. public class HW01_2 {
  11.  
  12. public static void main(String[] args) {
  13.  
  14. try(FileInputStream in = new FileInputStream(new File("izvor.txt"));
  15. FileOutputStream out = new FileOutputStream(new File("destinacija.txt"));
  16. ){
  17.  
  18. int c = 0;
  19. List<Integer> data = new ArrayList<>();
  20.  
  21. while ((c = in.read()) != -1){
  22. data.add(0, c);
  23. }
  24.  
  25. for (Integer i : data){
  26. out.write(i);
  27. }
  28.  
  29. } catch (IOException e) {
  30. System.err.println(e.getMessage());
  31. }
  32.  
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement