- All Superinterfaces:
AutoCloseable
,Closeable
,Flushable
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
copyCurrentEvent
(XContentParser parser) void
copyCurrentStructure
(XContentParser parser) boolean
isClosed()
Returnstrue
if this XContentGenerator has been closed.boolean
void
void
void
writeBinary
(byte[] value) void
writeBinary
(byte[] value, int offset, int length) void
writeBinaryField
(String name, byte[] value) void
writeBoolean
(boolean value) void
writeBooleanField
(String name, boolean value) void
writeDirectField
(String name, CheckedConsumer<OutputStream, IOException> writer) Write a field whose value is written directly to the output stream.void
void
void
writeFieldName
(String name) void
void
writeNullField
(String name) void
writeNumber
(double value) void
writeNumber
(float value) void
writeNumber
(int value) void
writeNumber
(long value) void
writeNumber
(short value) void
writeNumber
(BigDecimal value) void
writeNumber
(BigInteger value) void
writeNumberField
(String name, double value) void
writeNumberField
(String name, float value) void
writeNumberField
(String name, int value) void
writeNumberField
(String name, long value) void
writeNumberField
(String name, BigDecimal value) void
writeNumberField
(String name, BigInteger value) void
writeRawField
(String name, InputStream value) Deprecated.void
writeRawField
(String name, InputStream value, XContentType xContentType) Writes a raw field with the value taken from the bytes in the streamvoid
writeRawValue
(InputStream value, XContentType xContentType) Writes a raw value taken from the bytes in the streamvoid
writeRawValue
(String value) Writes a raw value taken from a pre-rendered string representationvoid
void
void
writeString
(char[] text, int offset, int len) void
writeString
(String value) void
writeStringArray
(String[] array) void
writeStringField
(String name, String value) void
writeUTF8String
(byte[] value, int offset, int length)
-
Method Details
-
contentType
XContentType contentType() -
usePrettyPrint
void usePrettyPrint() -
isPrettyPrint
boolean isPrettyPrint() -
usePrintLineFeedAtEnd
void usePrintLineFeedAtEnd() -
writeStartObject
- Throws:
IOException
-
writeEndObject
- Throws:
IOException
-
writeStartArray
- Throws:
IOException
-
writeEndArray
- Throws:
IOException
-
writeFieldName
- Throws:
IOException
-
writeNull
- Throws:
IOException
-
writeNullField
- Throws:
IOException
-
writeBooleanField
- Throws:
IOException
-
writeBoolean
- Throws:
IOException
-
writeNumberField
- Throws:
IOException
-
writeNumber
- Throws:
IOException
-
writeNumberField
- Throws:
IOException
-
writeNumber
- Throws:
IOException
-
writeNumberField
- Throws:
IOException
-
writeNumber
- Throws:
IOException
-
writeNumberField
- Throws:
IOException
-
writeNumber
- Throws:
IOException
-
writeNumber
- Throws:
IOException
-
writeNumber
- Throws:
IOException
-
writeNumberField
- Throws:
IOException
-
writeNumber
- Throws:
IOException
-
writeNumberField
- Throws:
IOException
-
writeStringField
- Throws:
IOException
-
writeString
- Throws:
IOException
-
writeStringArray
- Throws:
IOException
-
writeString
- Throws:
IOException
-
writeUTF8String
- Throws:
IOException
-
writeBinaryField
- Throws:
IOException
-
writeBinary
- Throws:
IOException
-
writeBinary
- Throws:
IOException
-
writeRawField
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
Writes a raw field with the value taken from the bytes in the stream- Throws:
IOException
-
writeRawValue
Writes a raw value taken from the bytes in the stream- Throws:
IOException
-
writeRawValue
Writes a raw value taken from a pre-rendered string representation- Throws:
IOException
-
copyCurrentStructure
- Throws:
IOException
-
writeDirectField
void writeDirectField(String name, CheckedConsumer<OutputStream, IOException> writer) throws IOExceptionWrite a field whose value is written directly to the output stream. As the content is copied as is, the writer must a valid XContent value (e.g., string is properly escaped and quoted)- Throws:
IOException
-
copyCurrentEvent
- Throws:
IOException
-
isClosed
boolean isClosed()Returnstrue
if this XContentGenerator has been closed. A closed generator can not do any more output.
-
writeRawField(String, InputStream, XContentType)
to avoid content type auto-detection