mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-31 19:40:38 +00:00
Move Writer creation out of WriterImpls
This commit is contained in:
parent
b5eef3ccad
commit
5dd602614c
4 changed files with 23 additions and 22 deletions
|
@ -5,22 +5,17 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
|
||||
import org.asamk.signal.util.Util;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class JsonWriterImpl implements JsonWriter {
|
||||
|
||||
private final Writer writer;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public JsonWriterImpl(final OutputStream outputStream) {
|
||||
this.writer = new BufferedWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
|
||||
|
||||
objectMapper = Util.createJsonObjectMapper();
|
||||
public JsonWriterImpl(final Writer writer) {
|
||||
this.writer = writer;
|
||||
this.objectMapper = Util.createJsonObjectMapper();
|
||||
}
|
||||
|
||||
public synchronized void write(final Object object) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue