I have no idea what validator expects from write(int c). I am sure it is ok. it was checked with various methods of transforming int to character or string , always with negative answer from validator irrespective of print or prinltn usage.
please help
package com.codegym.task.task19.task1917;
/*
Your own FileWriter
ąąąąąąąą
*/
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileWriter;
import java.io.IOException;
public class FileConsoleWriter {
private FileWriter fileWriter;
public FileConsoleWriter( String name) throws Exception {
this.fileWriter = new FileWriter(name);
}
public FileConsoleWriter( String name, boolean append) throws Exception {
this.fileWriter = new FileWriter(name, append);
}
public FileConsoleWriter( File file) throws Exception {
this.fileWriter = new FileWriter(file);
}
public FileConsoleWriter( File file, boolean append) throws Exception {
this.fileWriter = new FileWriter(file, append);
}
public FileConsoleWriter(FileDescriptor fd) {
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 = 0; i <len; i++) {
System.out.print(cbuf[off + i]) ;
}
}
public void write(int c) throws IOException {
this.fileWriter.write(c);
System.out.println( (char) c);
}
public void write(String str) throws IOException{
this.fileWriter.write(str);
System.out.print(str);
}
public void write(String str, int off, int len)throws IOException{
this.fileWriter.write(str, off, len);
System.out.print(str.substring(off,off+len) );
}
public void write(char[] cbuf) throws IOException{
this.fileWriter.write(cbuf);
for (int i = 0; i < cbuf.length; i++) {
System.out.print( cbuf[i] );
}
}
public void close() throws IOException{
this.fileWriter.close();
}
public static void main(String[] args) {
}
}