import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.io.PrintWriter; import java.io.IOException; public class FileInputOutput { public static void main(String[] args) { try { String input = "unko.txt"; String inputEncoding = "UTF-8"; String output = "unko2.txt"; String outputEncoding = "UTF-8"; BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(input), inputEncoding)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(output), outputEncoding))); String line = ""; while ((line = br.readLine()) != null) { pw.println(line); } br.close(); pw.close(); } catch (IOException e) { e.printStackTrace(); } } }