package cz.hobrasoft.pdfmu;

import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.OutputStream;

/**
 * An {@link ObjectMapper} that writes JSON documents to an {@link OutputStream}
 *
 * <p>
 * This class is a simple wrapper for {@link ObjectMapper} and
 * {@link OutputStream}.
 *
 * @author <a href="mailto:filip.bartek@hobrasoft.cz">Filip Bartek</a>
 */
public class WritingMapper {

    private final ObjectMapper mapper;
    private final OutputStream os;

    /**
     * Creates a {@link WritingMapper}
     *
     * @param mapper the {@link ObjectMapper} to use for writing JSON documents
     * @param os the target {@link OutputStream}
     */
    public WritingMapper(ObjectMapper mapper, OutputStream os) {
        this.mapper = mapper;
        this.os = os;
    }

    /**
     * Serializes a Java value as a JSON output, streaming it to the specified
     * {@link OutputStream}
     *
     * @param value the Java value to be serialized
     * @throws IOException if the underlying
     * {@link ObjectMapper#writeValue(OutputStream, Object)} throws an
     * {@link IOException}
     */
    public void writeValue(Object value) throws IOException {
        mapper.writeValue(os, value);
    }
}

@@ -77,16 +77,77 @@
 apper;%0D%0A
+import com.fasterxml.jackson.databind.SerializationFeature;%0D%0A
 import j
@@ -901,24 +901,270 @@
 ;%0D%0A    %7D%0D%0A%0D%0A
+    public WritingMapper() %7B%0D%0A        this.mapper = new ObjectMapper(); // Create a new mapper%0D%0A        mapper.enable(SerializationFeature.INDENT_OUTPUT); // Enable nice formatting%0D%0A        this.os = System.err; // Bind to %60System.err%60%0D%0A    %7D%0D%0A%0D%0A
     /**%0D%0A   

Add default constructor