mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
Refactor ReceiveMessageHandler
Introduce PlainTextWriter to improve indentation handling.
This commit is contained in:
parent
6c33a89f82
commit
03c30519b1
6 changed files with 641 additions and 507 deletions
23
src/main/java/org/asamk/signal/PlainTextWriter.java
Normal file
23
src/main/java/org/asamk/signal/PlainTextWriter.java
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue