You could extend from FileWriter class, provide a getter for file/filename:
public class MyFileWriter extends FileWriter {
private File file;
private boolean append = false;
public MyFileWriter(File file) throws IOException {
this(file, false);
}
public MyFileWriter(File file, boolean append) throws IOException {
super(file, append);
this.file = file;
this.append = append;
}
public MyFileWriter(String fileName) throws IOException {
this(new File(fileName));
}
public MyFileWriter(String fileName, boolean append) throws IOException {
this(new File(fileName), append);
}
// getters/setters
}
FileWritterreference but don't haveFile?