Interface XContentGenerator
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable,java.io.Flushable
- All Known Implementing Classes:
CborXContentGenerator,JsonXContentGenerator,SmileXContentGenerator,YamlXContentGenerator
public interface XContentGenerator extends java.io.Closeable, java.io.Flushable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description XContentTypecontentType()default voidcopyCurrentEvent(XContentParser parser)voidcopyCurrentStructure(XContentParser parser)booleanisClosed()Returnstrueif this XContentGenerator has been closed.booleanisPrettyPrint()voidusePrettyPrint()voidusePrintLineFeedAtEnd()voidwriteBinary(byte[] value)voidwriteBinary(byte[] value, int offset, int length)voidwriteBinaryField(java.lang.String name, byte[] value)voidwriteBoolean(boolean value)voidwriteBooleanField(java.lang.String name, boolean value)voidwriteEndArray()voidwriteEndObject()voidwriteFieldName(java.lang.String name)voidwriteNull()voidwriteNullField(java.lang.String name)voidwriteNumber(double value)voidwriteNumber(float value)voidwriteNumber(int value)voidwriteNumber(long value)voidwriteNumber(short value)voidwriteNumberField(java.lang.String name, double value)voidwriteNumberField(java.lang.String name, float value)voidwriteNumberField(java.lang.String name, int value)voidwriteNumberField(java.lang.String name, long value)voidwriteRawField(java.lang.String name, java.io.InputStream value)Deprecated.usewriteRawField(String, InputStream, XContentType)to avoid content type auto-detectionvoidwriteRawField(java.lang.String name, java.io.InputStream value, XContentType xContentType)Writes a raw field with the value taken from the bytes in the streamvoidwriteRawValue(java.io.InputStream value, XContentType xContentType)Writes a raw value taken from the bytes in the streamvoidwriteStartArray()voidwriteStartObject()voidwriteString(char[] text, int offset, int len)voidwriteString(java.lang.String value)voidwriteStringField(java.lang.String name, java.lang.String value)voidwriteUTF8String(byte[] value, int offset, int length)
-
-
-
Method Detail
-
contentType
XContentType contentType()
-
usePrettyPrint
void usePrettyPrint()
-
isPrettyPrint
boolean isPrettyPrint()
-
usePrintLineFeedAtEnd
void usePrintLineFeedAtEnd()
-
writeStartObject
void writeStartObject() throws java.io.IOException- Throws:
java.io.IOException
-
writeEndObject
void writeEndObject() throws java.io.IOException- Throws:
java.io.IOException
-
writeStartArray
void writeStartArray() throws java.io.IOException- Throws:
java.io.IOException
-
writeEndArray
void writeEndArray() throws java.io.IOException- Throws:
java.io.IOException
-
writeFieldName
void writeFieldName(java.lang.String name) throws java.io.IOException- Throws:
java.io.IOException
-
writeNull
void writeNull() throws java.io.IOException- Throws:
java.io.IOException
-
writeNullField
void writeNullField(java.lang.String name) throws java.io.IOException- Throws:
java.io.IOException
-
writeBooleanField
void writeBooleanField(java.lang.String name, boolean value) throws java.io.IOException- Throws:
java.io.IOException
-
writeBoolean
void writeBoolean(boolean value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumberField
void writeNumberField(java.lang.String name, double value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumber
void writeNumber(double value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumberField
void writeNumberField(java.lang.String name, float value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumber
void writeNumber(float value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumberField
void writeNumberField(java.lang.String name, int value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumber
void writeNumber(int value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumberField
void writeNumberField(java.lang.String name, long value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumber
void writeNumber(long value) throws java.io.IOException- Throws:
java.io.IOException
-
writeNumber
void writeNumber(short value) throws java.io.IOException- Throws:
java.io.IOException
-
writeStringField
void writeStringField(java.lang.String name, java.lang.String value) throws java.io.IOException- Throws:
java.io.IOException
-
writeString
void writeString(java.lang.String value) throws java.io.IOException- Throws:
java.io.IOException
-
writeString
void writeString(char[] text, int offset, int len) throws java.io.IOException- Throws:
java.io.IOException
-
writeUTF8String
void writeUTF8String(byte[] value, int offset, int length) throws java.io.IOException- Throws:
java.io.IOException
-
writeBinaryField
void writeBinaryField(java.lang.String name, byte[] value) throws java.io.IOException- Throws:
java.io.IOException
-
writeBinary
void writeBinary(byte[] value) throws java.io.IOException- Throws:
java.io.IOException
-
writeBinary
void writeBinary(byte[] value, int offset, int length) throws java.io.IOException- Throws:
java.io.IOException
-
writeRawField
@Deprecated void writeRawField(java.lang.String name, java.io.InputStream value) throws java.io.IOExceptionDeprecated.usewriteRawField(String, InputStream, XContentType)to avoid content type auto-detectionWrites a raw field with the value taken from the bytes in the stream- Throws:
java.io.IOException
-
writeRawField
void writeRawField(java.lang.String name, java.io.InputStream value, XContentType xContentType) throws java.io.IOExceptionWrites a raw field with the value taken from the bytes in the stream- Throws:
java.io.IOException
-
writeRawValue
void writeRawValue(java.io.InputStream value, XContentType xContentType) throws java.io.IOExceptionWrites a raw value taken from the bytes in the stream- Throws:
java.io.IOException
-
copyCurrentStructure
void copyCurrentStructure(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
copyCurrentEvent
default void copyCurrentEvent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
isClosed
boolean isClosed()
Returnstrueif this XContentGenerator has been closed. A closed generator can not do any more output.
-
-