org.apache.avro.io

## Class ParsingEncoder

- java.lang.Object
- - org.apache.avro.io.Encoder
  - - org.apache.avro.io.ParsingEncoder

- All Implemented Interfaces:
    Flushable
  Direct Known Subclasses:
    JsonEncoder, ValidatingEncoder

      public abstract class ParsingEncoder
      extends Encoder

  Base class for parser-based `Encoder`s.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `pos`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParsingEncoder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `depth()`
    `protected void` | `pop()`
    `protected void` | `push()` Push a new collection on to the stack.
    `void` | `setItemCount(long itemCount)` Call this method before writing a batch of items in an array or a map.
    `void` | `startItem()` Start a new item of an array or map.

    - ### Methods inherited from class org.apache.avro.io.Encoder

      `writeArrayEnd, writeArrayStart, writeBoolean, writeBytes, writeBytes, writeBytes, writeDouble, writeEnum, writeFixed, writeFixed, writeFixed, writeFloat, writeIndex, writeInt, writeLong, writeMapEnd, writeMapStart, writeNull, writeString, writeString, writeString`

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

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

    - ### Methods inherited from interface java.io.Flushable

      `flush`

- - ### Field Detail

    - #### pos

          protected int pos

  - ### Constructor Detail

    - #### ParsingEncoder

          public ParsingEncoder()

  - ### Method Detail

    - #### setItemCount

          public void setItemCount(long itemCount)
                            throws IOException

      Description copied from class: `Encoder`
      Call this method before writing a batch of items in an array or a map. Then for each item, call `Encoder.startItem()` followed by any of the other write methods of `Encoder`. The number of calls to `Encoder.startItem()` must be equal to the count specified in `Encoder.setItemCount(long)`. Once a batch is completed you can start another batch with `Encoder.setItemCount(long)`.
      Specified by:
        `setItemCount` in class `Encoder`
      Parameters:
        `itemCount` - The number of `Encoder.startItem()` calls to follow.
      Throws:
        `IOException`

    - #### startItem

          public void startItem()
                         throws IOException

      Description copied from class: `Encoder`
      Start a new item of an array or map. See `Encoder.writeArrayStart()` for usage information.
      Specified by:
        `startItem` in class `Encoder`
      Throws:
        `IOException`

    - #### push

          protected final void push()

      Push a new collection on to the stack.

    - #### pop

          protected final void pop()

    - #### depth

          protected final int depth()

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.