То ли я торможу, то ли лыжи не едут. Вроде все логично раскидал, а валидатор ни один метод, кроме close(), не принял. По конструкторам все норм - принимает все.
package com.javarush.task.task19.task1917;
/*
Свой FileWriter
*/
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileWriter;
import java.io.IOException;
public class FileConsoleWriter {
private FileWriter fileWriter;
FileConsoleWriter(File file) throws IOException {
fileWriter = new FileWriter(file);
}
FileConsoleWriter(File file, boolean append) throws IOException {
fileWriter = new FileWriter(file, append);
}
FileConsoleWriter(FileDescriptor fd) throws IOException {
fileWriter = new FileWriter(fd);
}
FileConsoleWriter(String fileName) throws IOException {
fileWriter = new FileWriter(fileName);
}
FileConsoleWriter(String fileName, boolean append) throws IOException {
fileWriter = new FileWriter(fileName, append);
}
public void write(char[] cbuf, int off, int len) throws IOException {
for (int i = off; i < len; i++) write(cbuf[i]);
}
public void write(int c) throws IOException {
char chr = (char) c;
fileWriter.write(chr);
System.out.print(chr);
}
public void write(String str) throws IOException {
write(str.toCharArray());
}
public void write(String str, int off, int len) throws IOException {
write(str.toCharArray(), off, len);
}
public void write(char[] cbuf) throws IOException {
for (int i = 0; i < cbuf.length; i++) write(cbuf[i]);
}
public void close() throws IOException {
this.fileWriter.close();
}
public static void main(String[] args) {
}
}
package com.javarush.task.task19.task1917;
/*
Свой FileWriter
*/
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileWriter;
import java.io.IOException;
public class FileConsoleWriter {
private FileWriter fileWriter;
FileConsoleWriter(File file) throws IOException {
fileWriter = new FileWriter(file);
}
FileConsoleWriter(File file, boolean append) throws IOException {
fileWriter = new FileWriter(file, append);
}
FileConsoleWriter(FileDescriptor fd) throws IOException {
fileWriter = new FileWriter(fd);
}
FileConsoleWriter(String fileName) throws IOException {
fileWriter = new FileWriter(fileName);
}
FileConsoleWriter(String fileName, boolean append) throws IOException {
fileWriter = new FileWriter(fileName, append);
}
public void write(char[] cbuf, int off, int len) throws IOException {
for (int i = off; i < len; i++) write(cbuf[i]);
}
public void write(int c) throws IOException {
char chr = (char) c;
fileWriter.write(chr);
System.out.print(chr);
}
public void write(String str) throws IOException {
write(str.toCharArray());
}
public void write(String str, int off, int len) throws IOException {
write(str.toCharArray(), off, len);
}
public void write(char[] cbuf) throws IOException {
for (int i = 0; i < cbuf.length; i++) write(cbuf[i]);
}
public void close() throws IOException {
this.fileWriter.close();
}
public static void main(String[] args) {
}
}