Class JsonXContentGenerator

java.lang.Object
org.opensearch.common.xcontent.json.JsonXContentGenerator
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, org.opensearch.core.xcontent.XContentGenerator
Direct Known Subclasses:
CborXContentGenerator, SmileXContentGenerator, YamlXContentGenerator

public class JsonXContentGenerator extends Object implements org.opensearch.core.xcontent.XContentGenerator
  • Field Details

    • generator

      protected final com.fasterxml.jackson.core.JsonGenerator generator
      Generator used to write content
  • Constructor Details

    • JsonXContentGenerator

      public JsonXContentGenerator(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, OutputStream os, Set<String> includes, Set<String> excludes)
  • Method Details

    • contentType

      public XContentType contentType()
      Specified by:
      contentType in interface org.opensearch.core.xcontent.XContentGenerator
    • usePrettyPrint

      public final void usePrettyPrint()
      Specified by:
      usePrettyPrint in interface org.opensearch.core.xcontent.XContentGenerator
    • isPrettyPrint

      public boolean isPrettyPrint()
      Specified by:
      isPrettyPrint in interface org.opensearch.core.xcontent.XContentGenerator
    • usePrintLineFeedAtEnd

      public void usePrintLineFeedAtEnd()
      Specified by:
      usePrintLineFeedAtEnd in interface org.opensearch.core.xcontent.XContentGenerator
    • writeStartObject

      public void writeStartObject() throws IOException
      Specified by:
      writeStartObject in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeEndObject

      public void writeEndObject() throws IOException
      Specified by:
      writeEndObject in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeStartArray

      public void writeStartArray() throws IOException
      Specified by:
      writeStartArray in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeEndArray

      public void writeEndArray() throws IOException
      Specified by:
      writeEndArray in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeFieldName

      public void writeFieldName(String name) throws IOException
      Specified by:
      writeFieldName in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNull

      public void writeNull() throws IOException
      Specified by:
      writeNull in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNullField

      public void writeNullField(String name) throws IOException
      Specified by:
      writeNullField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeBooleanField

      public void writeBooleanField(String name, boolean value) throws IOException
      Specified by:
      writeBooleanField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeBoolean

      public void writeBoolean(boolean value) throws IOException
      Specified by:
      writeBoolean in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumberField

      public void writeNumberField(String name, double value) throws IOException
      Specified by:
      writeNumberField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumber

      public void writeNumber(double value) throws IOException
      Specified by:
      writeNumber in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumberField

      public void writeNumberField(String name, float value) throws IOException
      Specified by:
      writeNumberField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumber

      public void writeNumber(float value) throws IOException
      Specified by:
      writeNumber in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumberField

      public void writeNumberField(String name, int value) throws IOException
      Specified by:
      writeNumberField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumberField

      public void writeNumberField(String name, BigInteger value) throws IOException
      Specified by:
      writeNumberField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumberField

      public void writeNumberField(String name, BigDecimal value) throws IOException
      Specified by:
      writeNumberField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumber

      public void writeNumber(int value) throws IOException
      Specified by:
      writeNumber in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumberField

      public void writeNumberField(String name, long value) throws IOException
      Specified by:
      writeNumberField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumber

      public void writeNumber(long value) throws IOException
      Specified by:
      writeNumber in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumber

      public void writeNumber(short value) throws IOException
      Specified by:
      writeNumber in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumber

      public void writeNumber(BigInteger value) throws IOException
      Specified by:
      writeNumber in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeNumber

      public void writeNumber(BigDecimal value) throws IOException
      Specified by:
      writeNumber in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeStringField

      public void writeStringField(String name, String value) throws IOException
      Specified by:
      writeStringField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeString

      public void writeString(String value) throws IOException
      Specified by:
      writeString in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeString

      public void writeString(char[] value, int offset, int len) throws IOException
      Specified by:
      writeString in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeUTF8String

      public void writeUTF8String(byte[] value, int offset, int length) throws IOException
      Specified by:
      writeUTF8String in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeBinaryField

      public void writeBinaryField(String name, byte[] value) throws IOException
      Specified by:
      writeBinaryField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeBinary

      public void writeBinary(byte[] value) throws IOException
      Specified by:
      writeBinary in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeBinary

      public void writeBinary(byte[] value, int offset, int len) throws IOException
      Specified by:
      writeBinary in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeEndRaw

      public void writeEndRaw()
    • writeRawField

      public void writeRawField(String name, InputStream content) throws IOException
      Specified by:
      writeRawField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeRawField

      public void writeRawField(String name, InputStream content, org.opensearch.core.xcontent.MediaType mediaType) throws IOException
      Writes a raw field with the value taken from the bytes in the stream
      Specified by:
      writeRawField in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • writeRawValue

      public void writeRawValue(InputStream stream, org.opensearch.core.xcontent.MediaType mediaType) throws IOException
      Writes the raw value to the stream
      Specified by:
      writeRawValue in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • supportsRawWrites

      protected boolean supportsRawWrites()
      Whether this generator supports writing raw data directly
    • copyRawValue

      protected void copyRawValue(InputStream stream, org.opensearch.core.xcontent.XContent xContent) throws IOException
      Throws:
      IOException
    • copyCurrentStructure

      public void copyCurrentStructure(org.opensearch.core.xcontent.XContentParser parser) throws IOException
      Specified by:
      copyCurrentStructure in interface org.opensearch.core.xcontent.XContentGenerator
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Specified by:
      flush in interface Flushable
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface org.opensearch.core.xcontent.XContentGenerator