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 Summary
FieldsModifier and TypeFieldDescriptionprotected final com.fasterxml.jackson.core.JsonGeneratorGenerator used to write content -
Constructor Summary
ConstructorsConstructorDescriptionJsonXContentGenerator(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, OutputStream os, Set<String> includes, Set<String> excludes) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcopyCurrentStructure(org.opensearch.core.xcontent.XContentParser parser) protected voidcopyRawValue(InputStream stream, org.opensearch.core.xcontent.XContent xContent) voidflush()booleanisClosed()booleanprotected booleanWhether this generator supports writing raw data directlyfinal voidvoidvoidwriteBinary(byte[] value) voidwriteBinary(byte[] value, int offset, int len) voidwriteBinaryField(String name, byte[] value) voidwriteBoolean(boolean value) voidwriteBooleanField(String name, boolean value) voidvoidvoidvoidwriteFieldName(String name) voidvoidwriteNullField(String name) voidwriteNumber(double value) voidwriteNumber(float value) voidwriteNumber(int value) voidwriteNumber(long value) voidwriteNumber(short value) voidwriteNumber(BigDecimal value) voidwriteNumber(BigInteger value) voidwriteNumberField(String name, double value) voidwriteNumberField(String name, float value) voidwriteNumberField(String name, int value) voidwriteNumberField(String name, long value) voidwriteNumberField(String name, BigDecimal value) voidwriteNumberField(String name, BigInteger value) voidwriteRawField(String name, InputStream content) voidwriteRawField(String name, InputStream content, org.opensearch.core.xcontent.MediaType mediaType) Writes a raw field with the value taken from the bytes in the streamvoidwriteRawValue(InputStream stream, org.opensearch.core.xcontent.MediaType mediaType) Writes the raw value to the streamvoidvoidvoidwriteString(char[] value, int offset, int len) voidwriteString(String value) voidwriteStringField(String name, String value) voidwriteUTF8String(byte[] value, int offset, int length) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensearch.core.xcontent.XContentGenerator
copyCurrentEvent
-
Field Details
-
generator
protected final com.fasterxml.jackson.core.JsonGenerator generatorGenerator 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
- Specified by:
contentTypein interfaceorg.opensearch.core.xcontent.XContentGenerator
-
usePrettyPrint
public final void usePrettyPrint()- Specified by:
usePrettyPrintin interfaceorg.opensearch.core.xcontent.XContentGenerator
-
isPrettyPrint
public boolean isPrettyPrint()- Specified by:
isPrettyPrintin interfaceorg.opensearch.core.xcontent.XContentGenerator
-
usePrintLineFeedAtEnd
public void usePrintLineFeedAtEnd()- Specified by:
usePrintLineFeedAtEndin interfaceorg.opensearch.core.xcontent.XContentGenerator
-
writeStartObject
- Specified by:
writeStartObjectin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeEndObject
- Specified by:
writeEndObjectin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeStartArray
- Specified by:
writeStartArrayin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeEndArray
- Specified by:
writeEndArrayin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeFieldName
- Specified by:
writeFieldNamein interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNull
- Specified by:
writeNullin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNullField
- Specified by:
writeNullFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeBooleanField
- Specified by:
writeBooleanFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeBoolean
- Specified by:
writeBooleanin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumberField
- Specified by:
writeNumberFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumberField
- Specified by:
writeNumberFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumberField
- Specified by:
writeNumberFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumberField
- Specified by:
writeNumberFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumberField
- Specified by:
writeNumberFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumberField
- Specified by:
writeNumberFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeStringField
- Specified by:
writeStringFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeString
- Specified by:
writeStringin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeString
- Specified by:
writeStringin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeUTF8String
- Specified by:
writeUTF8Stringin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeBinaryField
- Specified by:
writeBinaryFieldin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeBinary
- Specified by:
writeBinaryin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeBinary
- Specified by:
writeBinaryin interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
writeEndRaw
public void writeEndRaw() -
writeRawField
- Specified by:
writeRawFieldin interfaceorg.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:
writeRawFieldin interfaceorg.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:
writeRawValuein interfaceorg.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:
copyCurrentStructurein interfaceorg.opensearch.core.xcontent.XContentGenerator- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceorg.opensearch.core.xcontent.XContentGenerator
-