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
Modifier and Type Method Description XContentType
contentType()
default void
copyCurrentEvent(XContentParser parser)
void
copyCurrentStructure(XContentParser parser)
boolean
isClosed()
Returnstrue
if this XContentGenerator has been closed.boolean
isPrettyPrint()
void
usePrettyPrint()
void
usePrintLineFeedAtEnd()
void
writeBinary(byte[] value)
void
writeBinary(byte[] value, int offset, int length)
void
writeBinaryField(java.lang.String name, byte[] value)
void
writeBoolean(boolean value)
void
writeBooleanField(java.lang.String name, boolean value)
void
writeEndArray()
void
writeEndObject()
void
writeFieldName(java.lang.String name)
void
writeNull()
void
writeNullField(java.lang.String name)
void
writeNumber(double value)
void
writeNumber(float value)
void
writeNumber(int value)
void
writeNumber(long value)
void
writeNumber(short value)
void
writeNumber(java.math.BigDecimal value)
void
writeNumber(java.math.BigInteger value)
void
writeNumberField(java.lang.String name, double value)
void
writeNumberField(java.lang.String name, float value)
void
writeNumberField(java.lang.String name, int value)
void
writeNumberField(java.lang.String name, long value)
void
writeNumberField(java.lang.String name, java.math.BigDecimal value)
void
writeNumberField(java.lang.String name, java.math.BigInteger value)
void
writeRawField(java.lang.String name, java.io.InputStream value)
Deprecated.usewriteRawField(String, InputStream, XContentType)
to avoid content type auto-detectionvoid
writeRawField(java.lang.String name, java.io.InputStream value, XContentType xContentType)
Writes a raw field with the value taken from the bytes in the streamvoid
writeRawValue(java.io.InputStream value, XContentType xContentType)
Writes a raw value taken from the bytes in the streamvoid
writeStartArray()
void
writeStartObject()
void
writeString(char[] text, int offset, int len)
void
writeString(java.lang.String value)
void
writeStringField(java.lang.String name, java.lang.String value)
void
writeUTF8String(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
-
writeNumber
void writeNumber(java.math.BigInteger value) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNumberField
void writeNumberField(java.lang.String name, java.math.BigInteger value) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNumber
void writeNumber(java.math.BigDecimal value) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNumberField
void writeNumberField(java.lang.String name, java.math.BigDecimal 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.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:
java.io.IOException
-
writeRawField
void writeRawField(java.lang.String name, java.io.InputStream value, XContentType xContentType) throws java.io.IOException
Writes 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.IOException
Writes 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()
Returnstrue
if this XContentGenerator has been closed. A closed generator can not do any more output.
-
-