Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.ArrayList;
- public class RUnner {
- public static void main(String[] args) throws IOException {
- File izvor = new File("C:\\Users\\David\\Desktop\\test\\izvor.txt");
- File destinacija = new File("C:\\Users\\David\\Desktop\\test\\destinacija.txt");
- InputStream chitach = new FileInputStream(izvor);
- OutputStream zapishuvach = new FileOutputStream(destinacija);
- BufferedReader chitachDestinacija = new BufferedReader(new FileReader(destinacija));
- ArrayList<Integer> lista = new ArrayList<>();
- int bajt = 0;
- while ((bajt=chitach.read())!= -1){
- lista.add(bajt);
- }
- for (int i = lista.size() -1; i >= 0; i--) {
- zapishuvach.write(lista.get(i));
- }
- chitach.close();
- zapishuvach.flush();
- zapishuvach.close();
- String celosenText = "";
- while ((celosenText=chitachDestinacija.readLine())!=null){
- System.out.println(celosenText);
- }
- chitachDestinacija.close();
- }
- }
- =========================================================================================================
- import java.io.*;
- import java.util.ArrayList;
- public class RUnner {
- public static void main(String[] args) throws IOException {
- File izvor = new File("C:\\Users\\David\\Desktop\\test\\izvor.txt");
- File destinacija = new File("C:\\Users\\David\\Desktop\\test\\destinacija.txt");
- InputStream chitach = new FileInputStream(izvor);
- OutputStream zapishuvach = new FileOutputStream(destinacija);
- ArrayList<Integer> lista = new ArrayList<>();
- int bajt = 0;
- while ((bajt=chitach.read())!= -1){
- lista.add(bajt);
- }
- for (int i = lista.size() -1; i >= 0; i--) {
- zapishuvach.write(lista.get(i));
- }
- chitach.close();
- zapishuvach.flush();
- zapishuvach.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement