org.apache.synapse.commons.staxon.core.json.stream.util

## Class AutoArrayTarget

- java.lang.Object
- - org.apache.synapse.commons.staxon.core.json.stream.util.AutoArrayTarget

- All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, JsonStreamTarget

      public class AutoArrayTarget
      extends java.lang.Object
      implements JsonStreamTarget

  Target filter to auto-insert array boundaries.

  Note: this class caches all events and flushes to the underlying target after receiving the last close-object event, which may cause memory issues for large documents. Also, auto-recognition of array boundaries never creates arrays with a single element.

  It is recommended to handle array boundaries via the `JsonXMLStreamWriter.writeStartArray(String)` and `JsonXMLStreamWriter.writeEndArray()` methods or by producing `<?xml-muliple ...?>` processing instructions.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AutoArrayTarget(JsonStreamTarget delegate)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `endArray()` End array.
    `void` | `endObject()` End object.
    `void` | `flush()`
    `void` | `name(java.lang.String name)` Write name.
    `void` | `startArray()` Start array.
    `void` | `startObject()` Start object
    `void` | `value(java.lang.Object value)` Write value.

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

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

- - ### Constructor Detail

    - #### AutoArrayTarget

          public AutoArrayTarget(JsonStreamTarget delegate)

  - ### Method Detail

    - #### name

          public void name(java.lang.String name)
                    throws java.io.IOException

      Description copied from interface: `JsonStreamTarget`
      Write name.
      Specified by:
        `name` in interface `JsonStreamTarget`
      Throws:
        `java.io.IOException`

    - #### value

          public void value(java.lang.Object value)
                     throws java.io.IOException

      Description copied from interface: `JsonStreamTarget`
      Write value.
      Specified by:
        `value` in interface `JsonStreamTarget`
      Throws:
        `java.io.IOException`

    - #### startObject

          public void startObject()
                           throws java.io.IOException

      Description copied from interface: `JsonStreamTarget`
      Start object
      Specified by:
        `startObject` in interface `JsonStreamTarget`
      Throws:
        `java.io.IOException`

    - #### endObject

          public void endObject()
                         throws java.io.IOException

      Description copied from interface: `JsonStreamTarget`
      End object.
      Specified by:
        `endObject` in interface `JsonStreamTarget`
      Throws:
        `java.io.IOException`

    - #### startArray

          public void startArray()
                          throws java.io.IOException

      Description copied from interface: `JsonStreamTarget`
      Start array.
      Specified by:
        `startArray` in interface `JsonStreamTarget`
      Throws:
        `java.io.IOException`

    - #### endArray

          public void endArray()
                        throws java.io.IOException

      Description copied from interface: `JsonStreamTarget`
      End array.
      Specified by:
        `endArray` in interface `JsonStreamTarget`
      Throws:
        `java.io.IOException`

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Throws:
        `java.io.IOException`

    - #### flush

          public void flush()
                     throws java.io.IOException

      Specified by:
        `flush` in interface `java.io.Flushable`
      Throws:
        `java.io.IOException`

Copyright © 2005-2020 Apache Software Foundation. All Rights Reserved.