I´m pretty sure that's five constructors, so what's the deal here. When i compared it to the given Solution it is pretty much the same too, just with some different calls to print the lines but results the same.
Anyone got a clue?
package com.codegym.task.task19.task1917;
/*
Your own FileWriter
*/
import java.io.*;
import java.util.Arrays;
public class FileConsoleWriter {
private FileWriter fileWriter;
public FileConsoleWriter(String Filename) throws IOException{
this.fileWriter = new FileWriter(Filename);
}
public FileConsoleWriter(String name, Boolean b) throws IOException{
this.fileWriter = new FileWriter(name, b);
}
public FileConsoleWriter(File file) throws IOException{
this.fileWriter = new FileWriter(file);
}
public FileConsoleWriter(File f, boolean b) throws IOException{
this.fileWriter = new FileWriter(f, b);
}
public FileConsoleWriter(FileDescriptor fd) throws IOException{
this.fileWriter = new FileWriter(fd);
}
public void write(char[] cbuf, int off, int len) throws IOException {
this.fileWriter.write(cbuf,off,len);
for(int i= off; i< off+len; i++){
System.out.print(cbuf[i]);
}
System.out.println();
}
public void write(int c) throws IOException{
this.fileWriter.write(c);
System.out.println((char)c);
}
public void write(String s) throws IOException{
this.fileWriter.write(s);
System.out.println(s);
}
public void write(String s,int off, int len ) throws IOException{
this.fileWriter.write(s,off,len);
char[] c = s.toCharArray();
for(int i= off; i< off+len; i++){
System.out.print(c[i]);
}
System.out.println();
}
public void write(char[] c) throws IOException{
this.fileWriter.write(c);
for(int i=0; i< c.length; i++){
System.out.print(c[i]);
}
System.out.println();
}
public void close() throws IOException{
this.fileWriter.close();
}
public static void main(String[] args) {
}
}