Refactor ReceiveMessageHandler

Introduce PlainTextWriter to improve indentation handling.
This commit is contained in:
AsamK 2021-02-20 19:22:36 +01:00
parent 6c33a89f82
commit 03c30519b1
6 changed files with 641 additions and 507 deletions

View file

@ -0,0 +1,23 @@
package org.asamk.signal;
import java.io.IOException;
public interface PlainTextWriter {
void println(String format, Object... args) throws IOException;
PlainTextWriter indentedWriter();
default void println() throws IOException {
println("");
}
default void indent(final WriterConsumer subWriter) throws IOException {
subWriter.consume(indentedWriter());
}
interface WriterConsumer {
void consume(PlainTextWriter writer) throws IOException;
}
}