need help
package com.codegym.task.task18.task1813;
import java.awt.*;
import java.io.*;
/*
AmigoOutputStream
*/
public class AmigoOutputStream extends FileOutputStream{
public static String fileName = "C:/tmp/result.txt";
public FileOutputStream original;
public AmigoOutputStream(FileOutputStream f) throws FileNotFoundException {
super(fileName);
this.original=f;
}
@Override
public void close() throws IOException {
FileOutputStream f = new FileOutputStream(fileName);
while(true){
f.flush();
StringBuilder sb = new StringBuilder();
sb.append("CodeGym © All rights reserved.");
String data = sb.toString();
InputStream is = new ByteArrayInputStream(data.getBytes());
System.setIn(is);
}
}
public static void main(String[] args) throws FileNotFoundException {
new AmigoOutputStream(new FileOutputStream(fileName));
}
}