lolipop12

OS Lab 1.2

Mar 21st, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.ArrayList;
  3. import java.util.RandomAccess;
  4.  
  5. public class HW01_2 {
  6.     public static void main(String[] args) throws IOException {
  7.         RandomAccessFile raf = new RandomAccessFile("izvor.txt", "r");
  8.         PrintWriter pv=new PrintWriter(new FileOutputStream("destinacija.txt"));
  9. long pos=raf.length();
  10. raf.seek(pos--);
  11. int d;
  12. while(pos>-1){
  13.     raf.seek(pos--);
  14.     d=raf.read();
  15.     pv.write(d);
  16. }
  17.     raf.close();
  18. pv.close();
  19.         pv.flush();
  20.  
  21.     }
  22. }
Add Comment
Please, Sign In to add comment