asd
unknown
java
3 years ago
2.2 kB
2
Indexable
Never
interface ReadWriter { public void fileRead(); public void fileWrite(); } class Main { public static void main(String[] args) { } } class A implements ReadWriter { public void fileRead() { File file = new File("C:\\Users\\Arya\\Desktop\\input.txt"); BufferedReader br = new BufferedReader(new FileReader(file)); BufferedReader bufRdr = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); String line = null; line = bufRdr.readLine(); fileWrite(line); } public void fileWrite(String line) { File file = new File("C:\\Users\\Arya\\Desktop\\output.txt"); BufferedWriter bw = new BufferedWriter(new FileWriter(file)); bw.write(line); bw.close(); } } class B implements ReadWriter { public void fileRead() { File file = new File("C:\\Users\\Arya\\Desktop\\input.txt"); BufferedReader br = new BufferedReader(new FileReader(file)); BufferedReader bufRdr = new BufferedReader(new InputStreamReader(new FileInputStream(file), "ISO-8859-1")); String line = null; line = bufRdr.readLine(); fileWrite(line); } public void fileWrite(String line) { File file = new File("C:\\Users\\Arya\\Desktop\\output.txt"); BufferedWriter bw = new BufferedWriter(new FileWriter(file)); bw.write(line); bw.close(); } } class C implements ReadWriter { public void fileRead() { File file = new File("C:\\Users\\Arya\\Desktop\\input.txt"); BufferedReader br = new BufferedReader(new FileReader(file)); BufferedReader bufRdr = new BufferedReader(new InputStreamReader(new FileInputStream(file), "ISO-8859-1")); String line = null; line = bufRdr.readLine(); fileWrite(line); } public void fileWrite(String line) { File file = new File("C:\\Users\\Arya\\Desktop\\output.txt"); BufferedWriter bw = new BufferedWriter(new FileWriter(file)); bw.write(line); bw.close(); } }