Jak mam zadeklarować tutaj tą metodę
package pl.codegym.task.task18.task1813;
import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/*
AmigoOutputStream
*/
public class AmigoOutputStream extends FileOutputStream {
public static String fileName = "C:/tmp/result.txt";
FileOutputStream fileOutputStream;
public AmigoOutputStream(FileOutputStream fileOutputStream) throws FileNotFoundException {
super(String.valueOf(fileOutputStream));
this.fileOutputStream = fileOutputStream;
}
public static void main(String[] args) throws FileNotFoundException {
new AmigoOutputStream(new FileOutputStream(fileName));
}
public void close() throws IOException {
fileOutputStream.flush();
fileOutputStream.write("CodeGym © All rights reserved.".getBytes());
fileOutputStream.close();
}
}
/*package pl.codegym.task.task18.task1813;
import java.io.*;
AmigoOutputStream
public class AmigoOutputStream extends FileOutputStream {
public static String fileName = "C:/tmp/result.txt";
public FileOutputStream orginal;
public AmigoOutputStream (FileOutputStream orginal) throws FileNotFoundException {
super(String.valueOf((orginal)));
this.orginal = orginal;
}
public void write(int mess, byte [] tab) throws IOException {
orginal.write(mess);
}
public void flush() throws IOException {
orginal.flush();
}
public void close () throws IOException {
orginal.flush();
orginal.write(toString().getBytes());
orginal.close();
}
public static void main(String[] args) throws FileNotFoundException {
new AmigoOutputStream(new FileOutputStream(fileName));
}
}*/