ich habe nur einen input, wie lese und schreibe ich auf diesen?
package de.codegym.task.task19.task1915;
import java.io.*;
/*
Text duplizieren
*/
public class Solution {
public static TestString testString = new TestString();
public static void main(String[] args) throws IOException {
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
File file = new File(br.readLine());
BufferedReader reader = new BufferedReader(new FileReader(file));
FileOutputStream outStream = new FileOutputStream(file);
PrintStream console = System.out;
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintStream print = new PrintStream(out);
System.setOut(print);
testString.printSomething();
String result = out.toString();
System.setOut(console);
byte[] buffer = new byte[BufferedReader?????]
while(reader.ready())
System.out.println(result); /// what am i supposed to do here
outStream.write(result);
}
catch(IOException e){
}
}
public static class TestString {
public void printSomething() {
System.out.println("This is text for testing");
}
}
}