com.holonplatform.json.jackson.internal

## Class JacksonJsonWriter

- java.lang.Object
- - com.holonplatform.json.jackson.internal.JacksonJsonWriter

- All Implemented Interfaces:
    JsonWriter

      public class JacksonJsonWriter
      extends Object
      implements JsonWriter

  Jackson implementation of the `JsonWriter`.
  Since:
    5.1.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JacksonJsonWriter(com.fasterxml.jackson.databind.ObjectMapper mapper, Object value)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `asBytes()` Get the JSON data as a byte array.
    `String` | `asString()` Get the JSON data as a `String`.
    `void` | `write(Appendable writer)` Write the JSON data to given `Appendable` writer.
    `void` | `write(OutputStream stream, Charset charset)` Write the JSON data to given `OutputStream`, using the given `Charset` for encoding.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.json.JsonWriter

      `write, write`

- - ### Constructor Detail

    - #### JacksonJsonWriter

          public JacksonJsonWriter(com.fasterxml.jackson.databind.ObjectMapper mapper,
                                   Object value)

      Constructor
      Parameters:
        `mapper` - Jackson `ObjectMapper` (not null)
        `value` - Value to serialize

  - ### Method Detail

    - #### asString

          public String asString()

      Description copied from interface: `JsonWriter`
      Get the JSON data as a `String`.
      Specified by:
        `asString` in interface `JsonWriter`
      Returns:
        the JSON data as a String (may be null)

    - #### asBytes

          public byte[] asBytes()

      Description copied from interface: `JsonWriter`
      Get the JSON data as a byte array.

      By default, the UTF-8 charset is used for encoding.

      Specified by:
        `asBytes` in interface `JsonWriter`
      Returns:
        the JSON data as a byte array (may be null)

    - #### write

          public void write(Appendable writer)

      Description copied from interface: `JsonWriter`
      Write the JSON data to given `Appendable` writer.
      Specified by:
        `write` in interface `JsonWriter`
      Parameters:
        `writer` - the writer into which to write the JSON data (not null)

    - #### write

          public void write(OutputStream stream,
                            Charset charset)

      Description copied from interface: `JsonWriter`
      Write the JSON data to given `OutputStream`, using the given `Charset` for encoding.
      Specified by:
        `write` in interface `JsonWriter`
      Parameters:
        `stream` - the stream into which to write the JSON data (not null)
        `charset` - charset to use for encoding

Copyright © 2019 The Holon Platform. All rights reserved.