Interface XContentGenerator
-
- All Superinterfaces:
AutoCloseable,Closeable,Flushable
- All Known Implementing Classes:
JsonXContentGenerator
public interface XContentGenerator extends Closeable, 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(String name, byte[] value)voidwriteBoolean(boolean value)voidwriteBooleanField(String name, boolean value)voidwriteEndArray()voidwriteEndObject()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 value)Deprecated.usewriteRawField(String, InputStream, XContentType)to avoid content type auto-detectionvoidwriteRawField(String name, InputStream value, XContentType xContentType)Writes a raw field with the value taken from the bytes in the streamvoidwriteRawValue(InputStream value, XContentType xContentType)Writes a raw value taken from the bytes in the streamvoidwriteStartArray()voidwriteStartObject()voidwriteString(char[] text, int offset, int len)voidwriteString(String value)voidwriteStringField(String name, 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 IOException- Throws:
IOException
-
writeEndObject
void writeEndObject() throws IOException- Throws:
IOException
-
writeStartArray
void writeStartArray() throws IOException- Throws:
IOException
-
writeEndArray
void writeEndArray() throws IOException- Throws:
IOException
-
writeFieldName
void writeFieldName(String name) throws IOException
- Throws:
IOException
-
writeNull
void writeNull() throws IOException- Throws:
IOException
-
writeNullField
void writeNullField(String name) throws IOException
- Throws:
IOException
-
writeBooleanField
void writeBooleanField(String name, boolean value) throws IOException
- Throws:
IOException
-
writeBoolean
void writeBoolean(boolean value) throws IOException- Throws:
IOException
-
writeNumberField
void writeNumberField(String name, double value) throws IOException
- Throws:
IOException
-
writeNumber
void writeNumber(double value) throws IOException- Throws:
IOException
-
writeNumberField
void writeNumberField(String name, float value) throws IOException
- Throws:
IOException
-
writeNumber
void writeNumber(float value) throws IOException- Throws:
IOException
-
writeNumberField
void writeNumberField(String name, int value) throws IOException
- Throws:
IOException
-
writeNumber
void writeNumber(int value) throws IOException- Throws:
IOException
-
writeNumberField
void writeNumberField(String name, long value) throws IOException
- Throws:
IOException
-
writeNumber
void writeNumber(long value) throws IOException- Throws:
IOException
-
writeNumber
void writeNumber(short value) throws IOException- Throws:
IOException
-
writeNumber
void writeNumber(BigInteger value) throws IOException
- Throws:
IOException
-
writeNumberField
void writeNumberField(String name, BigInteger value) throws IOException
- Throws:
IOException
-
writeNumber
void writeNumber(BigDecimal value) throws IOException
- Throws:
IOException
-
writeNumberField
void writeNumberField(String name, BigDecimal value) throws IOException
- Throws:
IOException
-
writeStringField
void writeStringField(String name, String value) throws IOException
- Throws:
IOException
-
writeString
void writeString(String value) throws IOException
- Throws:
IOException
-
writeString
void writeString(char[] text, int offset, int len) throws IOException- Throws:
IOException
-
writeUTF8String
void writeUTF8String(byte[] value, int offset, int length) throws IOException- Throws:
IOException
-
writeBinaryField
void writeBinaryField(String name, byte[] value) throws IOException
- Throws:
IOException
-
writeBinary
void writeBinary(byte[] value) throws IOException- Throws:
IOException
-
writeBinary
void writeBinary(byte[] value, int offset, int length) throws IOException- Throws:
IOException
-
writeRawField
@Deprecated void writeRawField(String name, InputStream value) throws IOException
Deprecated.usewriteRawField(String, InputStream, XContentType)to avoid content type auto-detectionWrites a raw field with the value taken from the bytes in the stream- Throws:
IOException
-
writeRawField
void writeRawField(String name, InputStream value, XContentType xContentType) throws IOException
Writes a raw field with the value taken from the bytes in the stream- Throws:
IOException
-
writeRawValue
void writeRawValue(InputStream value, XContentType xContentType) throws IOException
Writes a raw value taken from the bytes in the stream- Throws:
IOException
-
copyCurrentStructure
void copyCurrentStructure(XContentParser parser) throws IOException
- Throws:
IOException
-
copyCurrentEvent
default void copyCurrentEvent(XContentParser parser) throws IOException
- Throws:
IOException
-
isClosed
boolean isClosed()
Returnstrueif this XContentGenerator has been closed. A closed generator can not do any more output.
-
-