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

@ -6,18 +6,20 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
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 JsonWriter {
private final OutputStreamWriter writer;
private final Writer writer;
private final ObjectMapper objectMapper;
public JsonWriter(final OutputStream writer) {
this.writer = new OutputStreamWriter(writer, StandardCharsets.UTF_8);
this.writer = new BufferedWriter(new OutputStreamWriter(writer, StandardCharsets.UTF_8));
objectMapper = new ObjectMapper();
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.PUBLIC_ONLY);