Class JsonXContentGenerator
- java.lang.Object
-
- org.elasticsearch.common.xcontent.json.JsonXContentGenerator
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,XContentGenerator
public class JsonXContentGenerator extends Object implements XContentGenerator
-
-
Field Summary
Fields Modifier and Type Field Description protected com.fasterxml.jackson.core.JsonGeneratorgeneratorGenerator used to write content
-
Constructor Summary
Constructors Constructor Description JsonXContentGenerator(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, OutputStream os, Set<String> includes, Set<String> excludes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()XContentTypecontentType()voidcopyCurrentStructure(XContentParser parser)protected voidcopyRawValue(InputStream stream, XContent xContent)voidflush()booleanisClosed()Returnstrueif this XContentGenerator has been closed.booleanisPrettyPrint()protected booleansupportsRawWrites()Whether this generator supports writing raw data directlyvoidusePrettyPrint()voidusePrintLineFeedAtEnd()voidwriteBinary(byte[] value)voidwriteBinary(byte[] value, int offset, int len)voidwriteBinaryField(String name, byte[] value)voidwriteBoolean(boolean value)voidwriteBooleanField(String name, boolean value)voidwriteEndArray()voidwriteEndObject()voidwriteEndRaw()voidwriteFieldName(String name)voidwriteNull()voidwriteNullField(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)Writes a raw field with the value taken from the bytes in the streamvoidwriteRawField(String name, InputStream content, XContentType contentType)Writes a raw field with the value taken from the bytes in the streamvoidwriteRawValue(InputStream stream, XContentType xContentType)Writes a raw value taken from the bytes in the streamvoidwriteStartArray()voidwriteStartObject()voidwriteString(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, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.XContentGenerator
copyCurrentEvent
-
-
-
-
Constructor Detail
-
JsonXContentGenerator
public JsonXContentGenerator(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, OutputStream os, Set<String> includes, Set<String> excludes)
-
-
Method Detail
-
contentType
public XContentType contentType()
- Specified by:
contentTypein interfaceXContentGenerator
-
usePrettyPrint
public final void usePrettyPrint()
- Specified by:
usePrettyPrintin interfaceXContentGenerator
-
isPrettyPrint
public boolean isPrettyPrint()
- Specified by:
isPrettyPrintin interfaceXContentGenerator
-
usePrintLineFeedAtEnd
public void usePrintLineFeedAtEnd()
- Specified by:
usePrintLineFeedAtEndin interfaceXContentGenerator
-
writeStartObject
public void writeStartObject() throws IOException- Specified by:
writeStartObjectin interfaceXContentGenerator- Throws:
IOException
-
writeEndObject
public void writeEndObject() throws IOException- Specified by:
writeEndObjectin interfaceXContentGenerator- Throws:
IOException
-
writeStartArray
public void writeStartArray() throws IOException- Specified by:
writeStartArrayin interfaceXContentGenerator- Throws:
IOException
-
writeEndArray
public void writeEndArray() throws IOException- Specified by:
writeEndArrayin interfaceXContentGenerator- Throws:
IOException
-
writeFieldName
public void writeFieldName(String name) throws IOException
- Specified by:
writeFieldNamein interfaceXContentGenerator- Throws:
IOException
-
writeNull
public void writeNull() throws IOException- Specified by:
writeNullin interfaceXContentGenerator- Throws:
IOException
-
writeNullField
public void writeNullField(String name) throws IOException
- Specified by:
writeNullFieldin interfaceXContentGenerator- Throws:
IOException
-
writeBooleanField
public void writeBooleanField(String name, boolean value) throws IOException
- Specified by:
writeBooleanFieldin interfaceXContentGenerator- Throws:
IOException
-
writeBoolean
public void writeBoolean(boolean value) throws IOException- Specified by:
writeBooleanin interfaceXContentGenerator- Throws:
IOException
-
writeNumberField
public void writeNumberField(String name, double value) throws IOException
- Specified by:
writeNumberFieldin interfaceXContentGenerator- Throws:
IOException
-
writeNumber
public void writeNumber(double value) throws IOException- Specified by:
writeNumberin interfaceXContentGenerator- Throws:
IOException
-
writeNumberField
public void writeNumberField(String name, float value) throws IOException
- Specified by:
writeNumberFieldin interfaceXContentGenerator- Throws:
IOException
-
writeNumber
public void writeNumber(float value) throws IOException- Specified by:
writeNumberin interfaceXContentGenerator- Throws:
IOException
-
writeNumberField
public void writeNumberField(String name, int value) throws IOException
- Specified by:
writeNumberFieldin interfaceXContentGenerator- Throws:
IOException
-
writeNumberField
public void writeNumberField(String name, BigInteger value) throws IOException
- Specified by:
writeNumberFieldin interfaceXContentGenerator- Throws:
IOException
-
writeNumberField
public void writeNumberField(String name, BigDecimal value) throws IOException
- Specified by:
writeNumberFieldin interfaceXContentGenerator- Throws:
IOException
-
writeNumber
public void writeNumber(int value) throws IOException- Specified by:
writeNumberin interfaceXContentGenerator- Throws:
IOException
-
writeNumberField
public void writeNumberField(String name, long value) throws IOException
- Specified by:
writeNumberFieldin interfaceXContentGenerator- Throws:
IOException
-
writeNumber
public void writeNumber(long value) throws IOException- Specified by:
writeNumberin interfaceXContentGenerator- Throws:
IOException
-
writeNumber
public void writeNumber(short value) throws IOException- Specified by:
writeNumberin interfaceXContentGenerator- Throws:
IOException
-
writeNumber
public void writeNumber(BigInteger value) throws IOException
- Specified by:
writeNumberin interfaceXContentGenerator- Throws:
IOException
-
writeNumber
public void writeNumber(BigDecimal value) throws IOException
- Specified by:
writeNumberin interfaceXContentGenerator- Throws:
IOException
-
writeStringField
public void writeStringField(String name, String value) throws IOException
- Specified by:
writeStringFieldin interfaceXContentGenerator- Throws:
IOException
-
writeString
public void writeString(String value) throws IOException
- Specified by:
writeStringin interfaceXContentGenerator- Throws:
IOException
-
writeString
public void writeString(char[] value, int offset, int len) throws IOException- Specified by:
writeStringin interfaceXContentGenerator- Throws:
IOException
-
writeUTF8String
public void writeUTF8String(byte[] value, int offset, int length) throws IOException- Specified by:
writeUTF8Stringin interfaceXContentGenerator- Throws:
IOException
-
writeBinaryField
public void writeBinaryField(String name, byte[] value) throws IOException
- Specified by:
writeBinaryFieldin interfaceXContentGenerator- Throws:
IOException
-
writeBinary
public void writeBinary(byte[] value) throws IOException- Specified by:
writeBinaryin interfaceXContentGenerator- Throws:
IOException
-
writeBinary
public void writeBinary(byte[] value, int offset, int len) throws IOException- Specified by:
writeBinaryin interfaceXContentGenerator- Throws:
IOException
-
writeEndRaw
public void writeEndRaw()
-
writeRawField
public void writeRawField(String name, InputStream content) throws IOException
Description copied from interface:XContentGeneratorWrites a raw field with the value taken from the bytes in the stream- Specified by:
writeRawFieldin interfaceXContentGenerator- Throws:
IOException
-
writeRawField
public void writeRawField(String name, InputStream content, XContentType contentType) throws IOException
Description copied from interface:XContentGeneratorWrites a raw field with the value taken from the bytes in the stream- Specified by:
writeRawFieldin interfaceXContentGenerator- Throws:
IOException
-
writeRawValue
public void writeRawValue(InputStream stream, XContentType xContentType) throws IOException
Description copied from interface:XContentGeneratorWrites a raw value taken from the bytes in the stream- Specified by:
writeRawValuein interfaceXContentGenerator- Throws:
IOException
-
supportsRawWrites
protected boolean supportsRawWrites()
Whether this generator supports writing raw data directly
-
copyRawValue
protected void copyRawValue(InputStream stream, XContent xContent) throws IOException
- Throws:
IOException
-
copyCurrentStructure
public void copyCurrentStructure(XContentParser parser) throws IOException
- Specified by:
copyCurrentStructurein interfaceXContentGenerator- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isClosed
public boolean isClosed()
Description copied from interface:XContentGeneratorReturnstrueif this XContentGenerator has been closed. A closed generator can not do any more output.- Specified by:
isClosedin interfaceXContentGenerator
-
-