@Override
    public void write(char[] cbuf, int off, int len) throws IOException {
        String str = new String(cbuf, off, len);
        if (error) {
            console.printError(str);
        }
        else {
            console.print(str);
        }
    }
@see java.io.Writer#write(char[], int, int)
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/console/ConsoleWriter.java