I am trying to intercept the red Empty page!! message that gets printed to my screen when using Tess4J. I wrote a short interceptor class that overrides print and println and replaced stdout and stderr to check for this string:
private static class Interceptor extends PrintStream {
public Interceptor(OutputStream out) {
super(out, true);
}
@Override
public void print(String s) {
if ( !s.contains("Empty page!!") )
super.print(s);
}
@Override
public void println(String s) {
if ( !s.contains("Empty page!!") )
super.println(s);
}
}
I tested the class: It works and suppresses any Empty page!! that I write to stdout and stderr. I do not succeed in catching the Empty page!! message from Tess4J that gets printed to my console in red though. My question: How can I intercept and suppress this message?
Thanks a bunch.

You may want to emulate Tesseract's
quietcommand-line option, which hasdebug_file /dev/null.or