Class JsonXContentGenerator

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

public class JsonXContentGenerator
extends java.lang.Object
implements 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, java.io.OutputStream os, java.util.Set<java.lang.String> includes, java.util.Set<java.lang.String> excludes)
  • Method Details

    • contentType

      public XContentType contentType()
      Specified by:
      contentType in interface XContentGenerator
    • usePrettyPrint

      public final void usePrettyPrint()
      Specified by:
      usePrettyPrint in interface XContentGenerator
    • isPrettyPrint

      public boolean isPrettyPrint()
      Specified by:
      isPrettyPrint in interface XContentGenerator
    • usePrintLineFeedAtEnd

      public void usePrintLineFeedAtEnd()
      Specified by:
      usePrintLineFeedAtEnd in interface XContentGenerator
    • writeStartObject

      public void writeStartObject() throws java.io.IOException
      Specified by:
      writeStartObject in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeEndObject

      public void writeEndObject() throws java.io.IOException
      Specified by:
      writeEndObject in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeStartArray

      public void writeStartArray() throws java.io.IOException
      Specified by:
      writeStartArray in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeEndArray

      public void writeEndArray() throws java.io.IOException
      Specified by:
      writeEndArray in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeFieldName

      public void writeFieldName​(java.lang.String name) throws java.io.IOException
      Specified by:
      writeFieldName in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNull

      public void writeNull() throws java.io.IOException
      Specified by:
      writeNull in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNullField

      public void writeNullField​(java.lang.String name) throws java.io.IOException
      Specified by:
      writeNullField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeBooleanField

      public void writeBooleanField​(java.lang.String name, boolean value) throws java.io.IOException
      Specified by:
      writeBooleanField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeBoolean

      public void writeBoolean​(boolean value) throws java.io.IOException
      Specified by:
      writeBoolean in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumberField

      public void writeNumberField​(java.lang.String name, double value) throws java.io.IOException
      Specified by:
      writeNumberField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumber

      public void writeNumber​(double value) throws java.io.IOException
      Specified by:
      writeNumber in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumberField

      public void writeNumberField​(java.lang.String name, float value) throws java.io.IOException
      Specified by:
      writeNumberField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumber

      public void writeNumber​(float value) throws java.io.IOException
      Specified by:
      writeNumber in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumberField

      public void writeNumberField​(java.lang.String name, int value) throws java.io.IOException
      Specified by:
      writeNumberField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumberField

      public void writeNumberField​(java.lang.String name, java.math.BigInteger value) throws java.io.IOException
      Specified by:
      writeNumberField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumberField

      public void writeNumberField​(java.lang.String name, java.math.BigDecimal value) throws java.io.IOException
      Specified by:
      writeNumberField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumber

      public void writeNumber​(int value) throws java.io.IOException
      Specified by:
      writeNumber in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumberField

      public void writeNumberField​(java.lang.String name, long value) throws java.io.IOException
      Specified by:
      writeNumberField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumber

      public void writeNumber​(long value) throws java.io.IOException
      Specified by:
      writeNumber in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumber

      public void writeNumber​(short value) throws java.io.IOException
      Specified by:
      writeNumber in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumber

      public void writeNumber​(java.math.BigInteger value) throws java.io.IOException
      Specified by:
      writeNumber in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeNumber

      public void writeNumber​(java.math.BigDecimal value) throws java.io.IOException
      Specified by:
      writeNumber in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeStringField

      public void writeStringField​(java.lang.String name, java.lang.String value) throws java.io.IOException
      Specified by:
      writeStringField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeString

      public void writeString​(java.lang.String value) throws java.io.IOException
      Specified by:
      writeString in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeString

      public void writeString​(char[] value, int offset, int len) throws java.io.IOException
      Specified by:
      writeString in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeUTF8String

      public void writeUTF8String​(byte[] value, int offset, int length) throws java.io.IOException
      Specified by:
      writeUTF8String in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeBinaryField

      public void writeBinaryField​(java.lang.String name, byte[] value) throws java.io.IOException
      Specified by:
      writeBinaryField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeBinary

      public void writeBinary​(byte[] value) throws java.io.IOException
      Specified by:
      writeBinary in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeBinary

      public void writeBinary​(byte[] value, int offset, int len) throws java.io.IOException
      Specified by:
      writeBinary in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeEndRaw

      public void writeEndRaw()
    • writeRawField

      public void writeRawField​(java.lang.String name, java.io.InputStream content) throws java.io.IOException
      Description copied from interface: XContentGenerator
      Writes a raw field with the value taken from the bytes in the stream
      Specified by:
      writeRawField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeRawField

      public void writeRawField​(java.lang.String name, java.io.InputStream content, XContentType contentType) throws java.io.IOException
      Description copied from interface: XContentGenerator
      Writes a raw field with the value taken from the bytes in the stream
      Specified by:
      writeRawField in interface XContentGenerator
      Throws:
      java.io.IOException
    • writeRawValue

      public void writeRawValue​(java.io.InputStream stream, XContentType xContentType) throws java.io.IOException
      Description copied from interface: XContentGenerator
      Writes a raw value taken from the bytes in the stream
      Specified by:
      writeRawValue in interface XContentGenerator
      Throws:
      java.io.IOException
    • supportsRawWrites

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

      protected void copyRawValue​(java.io.InputStream stream, XContent xContent) throws java.io.IOException
      Throws:
      java.io.IOException
    • copyCurrentStructure

      public void copyCurrentStructure​(XContentParser parser) throws java.io.IOException
      Specified by:
      copyCurrentStructure in interface XContentGenerator
      Throws:
      java.io.IOException
    • flush

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

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

      public boolean isClosed()
      Description copied from interface: XContentGenerator
      Returns true if this XContentGenerator has been closed. A closed generator can not do any more output.
      Specified by:
      isClosed in interface XContentGenerator