Refactor output writers

This commit is contained in:
AsamK 2021-08-08 17:32:55 +02:00
parent f449a242e4
commit 48b2c7ff8a
42 changed files with 327 additions and 187 deletions

View file

@ -1,6 +1,8 @@
package org.asamk.signal;
public interface PlainTextWriter {
import java.util.function.Consumer;
public interface PlainTextWriter extends OutputWriter {
void println(String format, Object... args);
@ -10,12 +12,7 @@ public interface PlainTextWriter {
println("");
}
default void indent(final WriterConsumer subWriter) {
subWriter.consume(indentedWriter());
}
interface WriterConsumer {
void consume(PlainTextWriter writer);
default void indent(final Consumer<PlainTextWriter> subWriter) {
subWriter.accept(indentedWriter());
}
}