Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package zad2;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.io.OutputStreamWriter;
- import java.io.FileNotFoundException;
- import java.util.ArrayList;
- public class Lab01_zad02 {
- public static void main(String[] args) throws IOException {
- File source = null;
- File destination = null;
- source = new File("izvor.txt");
- destination = new File("destinacija.txt");
- FileInputStream fis = new FileInputStream(source);
- FileOutputStream fos = new FileOutputStream(destination);
- InputStreamReader in = new InputStreamReader(fis);
- OutputStreamWriter out = new OutputStreamWriter(fos);
- try {
- char[] array = new char[100];
- in.read(array);
- StringBuilder sb = new StringBuilder();
- for (int i = array.length - 1; i >= 0; i--) {
- sb.append(array[i]);
- }
- String content = sb.toString();
- out.write(content);
- } finally {
- in.close();
- out.close();
- }
- }
- }
Add Comment
Please, Sign In to add comment