org.elasticsearch.common.xcontent
Class XContentBuilder

java.lang.Object
  extended by org.elasticsearch.common.xcontent.XContentBuilder

public final class XContentBuilder
extends java.lang.Object


Nested Class Summary
static class XContentBuilder.FieldCaseConversion
           
 
Field Summary
static org.elasticsearch.common.joda.time.format.DateTimeFormatter defaultDatePrinter
           
protected static XContentBuilder.FieldCaseConversion globalFieldCaseConversion
           
 
Constructor Summary
XContentBuilder(XContent xContent, java.io.OutputStream bos)
          Constructs a new builder using the provided xcontent and an OutputStream.
XContentBuilder(XContent xContent, java.io.OutputStream bos, java.lang.Object payload)
          Constructs a new builder using the provided xcontent and an OutputStream.
 
Method Summary
 XContentBuilder array(java.lang.String name, java.lang.Object... values)
           
 XContentBuilder array(java.lang.String name, java.lang.String... values)
           
 XContentBuilder array(XContentBuilderString name, java.lang.Object... values)
           
 XContentBuilder array(XContentBuilderString name, java.lang.String... values)
           
static XContentBuilder builder(XContent xContent)
          Constructs a new builder using a fresh FastByteArrayOutputStream.
static XContentBuilder cachedBuilder(XContent xContent)
          Constructs a new cached builder over a cached (thread local) FastByteArrayOutputStream.
 void close()
           
 XContentType contentType()
           
 byte[] copiedBytes()
          Returns a copy of the bytes this builder generated.
 XContentBuilder copyCurrentStructure(XContentParser parser)
           
 XContentBuilder endArray()
           
 XContentBuilder endObject()
           
 XContentBuilder field(java.lang.String name)
           
 XContentBuilder field(java.lang.String name, boolean value)
           
 XContentBuilder field(java.lang.String name, byte[] value)
           
 XContentBuilder field(java.lang.String name, byte[] value, int offset, int length)
           
 XContentBuilder field(java.lang.String name, char[] value, int offset, int length)
           
 XContentBuilder field(java.lang.String name, java.util.Date date)
           
 XContentBuilder field(java.lang.String name, java.util.Date date, org.elasticsearch.common.joda.time.format.DateTimeFormatter formatter)
           
 XContentBuilder field(java.lang.String name, double... value)
           
 XContentBuilder field(java.lang.String name, double value)
           
 XContentBuilder field(java.lang.String name, java.lang.Double value)
           
 XContentBuilder field(java.lang.String name, float... value)
           
 XContentBuilder field(java.lang.String name, float value)
           
 XContentBuilder field(java.lang.String name, java.lang.Float value)
           
 XContentBuilder field(java.lang.String name, int... value)
           
 XContentBuilder field(java.lang.String name, int value)
           
 XContentBuilder field(java.lang.String name, java.lang.Integer value)
           
 XContentBuilder field(java.lang.String name, java.util.List value)
           
 XContentBuilder field(java.lang.String name, long... value)
           
 XContentBuilder field(java.lang.String name, long value)
           
 XContentBuilder field(java.lang.String name, java.lang.Long value)
           
 XContentBuilder field(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> value)
           
 XContentBuilder field(java.lang.String name, java.lang.Object value)
           
 XContentBuilder field(java.lang.String name, org.elasticsearch.common.joda.time.ReadableInstant date)
           
 XContentBuilder field(java.lang.String name, org.elasticsearch.common.joda.time.ReadableInstant date, org.elasticsearch.common.joda.time.format.DateTimeFormatter formatter)
           
 XContentBuilder field(java.lang.String name, java.lang.String... value)
           
 XContentBuilder field(java.lang.String name, java.lang.String value)
           
 XContentBuilder field(java.lang.String name, ToXContent xContent)
           
 XContentBuilder field(java.lang.String name, ToXContent xContent, ToXContent.Params params)
           
 XContentBuilder field(java.lang.String name, XContentBuilder.FieldCaseConversion conversion)
           
 XContentBuilder field(XContentBuilderString name)
           
 XContentBuilder field(XContentBuilderString name, boolean value)
           
 XContentBuilder field(XContentBuilderString name, byte[] value)
           
 XContentBuilder field(XContentBuilderString name, char[] value, int offset, int length)
           
 XContentBuilder field(XContentBuilderString name, java.util.Date date)
           
 XContentBuilder field(XContentBuilderString name, java.util.Date date, org.elasticsearch.common.joda.time.format.DateTimeFormatter formatter)
           
 XContentBuilder field(XContentBuilderString name, double... value)
           
 XContentBuilder field(XContentBuilderString name, double value)
           
 XContentBuilder field(XContentBuilderString name, java.lang.Double value)
           
 XContentBuilder field(XContentBuilderString name, float... value)
           
 XContentBuilder field(XContentBuilderString name, float value)
           
 XContentBuilder field(XContentBuilderString name, java.lang.Float value)
           
 XContentBuilder field(XContentBuilderString name, int... value)
           
 XContentBuilder field(XContentBuilderString name, int value)
           
 XContentBuilder field(XContentBuilderString name, java.lang.Integer value)
           
 XContentBuilder field(XContentBuilderString name, java.util.List value)
           
 XContentBuilder field(XContentBuilderString name, long... value)
           
 XContentBuilder field(XContentBuilderString name, long value)
           
 XContentBuilder field(XContentBuilderString name, java.lang.Long value)
           
 XContentBuilder field(XContentBuilderString name, java.util.Map<java.lang.String,java.lang.Object> value)
           
 XContentBuilder field(XContentBuilderString name, java.lang.Object value)
           
 XContentBuilder field(XContentBuilderString name, org.elasticsearch.common.joda.time.ReadableInstant date)
           
 XContentBuilder field(XContentBuilderString name, org.elasticsearch.common.joda.time.ReadableInstant date, org.elasticsearch.common.joda.time.format.DateTimeFormatter formatter)
           
 XContentBuilder field(XContentBuilderString name, java.lang.String... value)
           
 XContentBuilder field(XContentBuilderString name, java.lang.String value)
           
 XContentBuilder fieldCaseConversion(XContentBuilder.FieldCaseConversion fieldCaseConversion)
           
 XContentBuilder flush()
           
static void globalFieldCaseConversion(XContentBuilder.FieldCaseConversion globalFieldCaseConversion)
           
 XContentBuilder map(java.util.Map<java.lang.String,java.lang.Object> map)
           
 XContentBuilder nullField(java.lang.String name)
           
 XContentBuilder nullField(XContentBuilderString name)
           
 XContentBuilder nullValue()
           
 java.lang.Object payload()
           
 XContentBuilder prettyPrint()
           
 XContentBuilder rawField(java.lang.String fieldName, byte[] content)
           
 XContentBuilder rawField(java.lang.String fieldName, byte[] content, int offset, int length)
           
 XContentBuilder rawField(java.lang.String fieldName, java.io.InputStream content)
           
 XContentBuilder startArray()
           
 XContentBuilder startArray(java.lang.String name)
           
 XContentBuilder startArray(java.lang.String name, XContentBuilder.FieldCaseConversion conversion)
           
 XContentBuilder startArray(XContentBuilderString name)
           
 XContentBuilder startObject()
           
 XContentBuilder startObject(java.lang.String name)
           
 XContentBuilder startObject(java.lang.String name, XContentBuilder.FieldCaseConversion conversion)
           
 XContentBuilder startObject(XContentBuilderString name)
           
 java.io.OutputStream stream()
           
 java.lang.String string()
          Returns a string representation of the builder (only applicable for text based xcontent).
 byte[] unsafeBytes()
          Returns the unsafe bytes (thread local bound).
 int unsafeBytesLength()
          Returns the unsafe bytes length (thread local bound).
 BytesStream unsafeStream()
          Returns the actual stream used.
 XContentBuilder value(boolean value)
           
 XContentBuilder value(java.lang.Boolean value)
           
 XContentBuilder value(byte[] value)
           
 XContentBuilder value(byte[] value, int offset, int length)
           
 XContentBuilder value(java.util.Date date)
           
 XContentBuilder value(java.util.Date date, org.elasticsearch.common.joda.time.format.DateTimeFormatter dateTimeFormatter)
           
 XContentBuilder value(double value)
           
 XContentBuilder value(java.lang.Double value)
           
 XContentBuilder value(float value)
           
 XContentBuilder value(java.lang.Float value)
           
 XContentBuilder value(int value)
           
 XContentBuilder value(java.lang.Integer value)
           
 XContentBuilder value(long value)
           
 XContentBuilder value(java.lang.Long value)
           
 XContentBuilder value(java.util.Map<java.lang.String,java.lang.Object> map)
           
 XContentBuilder value(java.lang.Object value)
           
 XContentBuilder value(org.elasticsearch.common.joda.time.ReadableInstant date)
           
 XContentBuilder value(org.elasticsearch.common.joda.time.ReadableInstant date, org.elasticsearch.common.joda.time.format.DateTimeFormatter dateTimeFormatter)
           
 XContentBuilder value(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultDatePrinter

public static final org.elasticsearch.common.joda.time.format.DateTimeFormatter defaultDatePrinter

globalFieldCaseConversion

protected static XContentBuilder.FieldCaseConversion globalFieldCaseConversion
Constructor Detail

XContentBuilder

public XContentBuilder(XContent xContent,
                       java.io.OutputStream bos)
                throws java.io.IOException
Constructs a new builder using the provided xcontent and an OutputStream. Make sure to call close() when the builder is done with.

Throws:
java.io.IOException

XContentBuilder

public XContentBuilder(XContent xContent,
                       java.io.OutputStream bos,
                       @Nullable
                       java.lang.Object payload)
                throws java.io.IOException
Constructs a new builder using the provided xcontent and an OutputStream. Make sure to call close() when the builder is done with.

Throws:
java.io.IOException
Method Detail

globalFieldCaseConversion

public static void globalFieldCaseConversion(XContentBuilder.FieldCaseConversion globalFieldCaseConversion)

cachedBuilder

public static XContentBuilder cachedBuilder(XContent xContent)
                                     throws java.io.IOException
Constructs a new cached builder over a cached (thread local) FastByteArrayOutputStream.

Throws:
java.io.IOException

builder

public static XContentBuilder builder(XContent xContent)
                               throws java.io.IOException
Constructs a new builder using a fresh FastByteArrayOutputStream.

Throws:
java.io.IOException

fieldCaseConversion

public XContentBuilder fieldCaseConversion(XContentBuilder.FieldCaseConversion fieldCaseConversion)

contentType

public XContentType contentType()

prettyPrint

public XContentBuilder prettyPrint()

field

public XContentBuilder field(java.lang.String name,
                             ToXContent xContent)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             ToXContent xContent,
                             ToXContent.Params params)
                      throws java.io.IOException
Throws:
java.io.IOException

startObject

public XContentBuilder startObject(java.lang.String name)
                            throws java.io.IOException
Throws:
java.io.IOException

startObject

public XContentBuilder startObject(java.lang.String name,
                                   XContentBuilder.FieldCaseConversion conversion)
                            throws java.io.IOException
Throws:
java.io.IOException

startObject

public XContentBuilder startObject(XContentBuilderString name)
                            throws java.io.IOException
Throws:
java.io.IOException

startObject

public XContentBuilder startObject()
                            throws java.io.IOException
Throws:
java.io.IOException

endObject

public XContentBuilder endObject()
                          throws java.io.IOException
Throws:
java.io.IOException

array

public XContentBuilder array(java.lang.String name,
                             java.lang.String... values)
                      throws java.io.IOException
Throws:
java.io.IOException

array

public XContentBuilder array(XContentBuilderString name,
                             java.lang.String... values)
                      throws java.io.IOException
Throws:
java.io.IOException

array

public XContentBuilder array(java.lang.String name,
                             java.lang.Object... values)
                      throws java.io.IOException
Throws:
java.io.IOException

array

public XContentBuilder array(XContentBuilderString name,
                             java.lang.Object... values)
                      throws java.io.IOException
Throws:
java.io.IOException

startArray

public XContentBuilder startArray(java.lang.String name,
                                  XContentBuilder.FieldCaseConversion conversion)
                           throws java.io.IOException
Throws:
java.io.IOException

startArray

public XContentBuilder startArray(java.lang.String name)
                           throws java.io.IOException
Throws:
java.io.IOException

startArray

public XContentBuilder startArray(XContentBuilderString name)
                           throws java.io.IOException
Throws:
java.io.IOException

startArray

public XContentBuilder startArray()
                           throws java.io.IOException
Throws:
java.io.IOException

endArray

public XContentBuilder endArray()
                         throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             XContentBuilder.FieldCaseConversion conversion)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             char[] value,
                             int offset,
                             int length)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             char[] value,
                             int offset,
                             int length)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.lang.String value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.lang.String value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.lang.Integer value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.lang.Integer value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             int value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             int value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.lang.Long value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.lang.Long value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             long value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             long value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.lang.Float value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.lang.Float value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             float value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             float value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.lang.Double value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.lang.Double value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             double value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             double value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             byte[] value,
                             int offset,
                             int length)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.util.Map<java.lang.String,java.lang.Object> value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.util.Map<java.lang.String,java.lang.Object> value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.util.List value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.util.List value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.lang.String... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.lang.String... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             int... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             int... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             long... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             long... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             float... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             float... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             double... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             double... value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.lang.Object value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.lang.Object value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.lang.Object value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             boolean value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             boolean value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             byte[] value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             byte[] value)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             org.elasticsearch.common.joda.time.ReadableInstant date)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             org.elasticsearch.common.joda.time.ReadableInstant date)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             org.elasticsearch.common.joda.time.ReadableInstant date,
                             org.elasticsearch.common.joda.time.format.DateTimeFormatter formatter)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             org.elasticsearch.common.joda.time.ReadableInstant date,
                             org.elasticsearch.common.joda.time.format.DateTimeFormatter formatter)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.util.Date date)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.util.Date date)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(java.lang.String name,
                             java.util.Date date,
                             org.elasticsearch.common.joda.time.format.DateTimeFormatter formatter)
                      throws java.io.IOException
Throws:
java.io.IOException

field

public XContentBuilder field(XContentBuilderString name,
                             java.util.Date date,
                             org.elasticsearch.common.joda.time.format.DateTimeFormatter formatter)
                      throws java.io.IOException
Throws:
java.io.IOException

nullField

public XContentBuilder nullField(java.lang.String name)
                          throws java.io.IOException
Throws:
java.io.IOException

nullField

public XContentBuilder nullField(XContentBuilderString name)
                          throws java.io.IOException
Throws:
java.io.IOException

nullValue

public XContentBuilder nullValue()
                          throws java.io.IOException
Throws:
java.io.IOException

rawField

public XContentBuilder rawField(java.lang.String fieldName,
                                byte[] content)
                         throws java.io.IOException
Throws:
java.io.IOException

rawField

public XContentBuilder rawField(java.lang.String fieldName,
                                byte[] content,
                                int offset,
                                int length)
                         throws java.io.IOException
Throws:
java.io.IOException

rawField

public XContentBuilder rawField(java.lang.String fieldName,
                                java.io.InputStream content)
                         throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.lang.Boolean value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(boolean value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(org.elasticsearch.common.joda.time.ReadableInstant date)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(org.elasticsearch.common.joda.time.ReadableInstant date,
                             org.elasticsearch.common.joda.time.format.DateTimeFormatter dateTimeFormatter)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.util.Date date)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.util.Date date,
                             org.elasticsearch.common.joda.time.format.DateTimeFormatter dateTimeFormatter)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.lang.Integer value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(int value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.lang.Long value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(long value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.lang.Float value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(float value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.lang.Double value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(double value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.lang.String value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(byte[] value)
                      throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(byte[] value,
                             int offset,
                             int length)
                      throws java.io.IOException
Throws:
java.io.IOException

map

public XContentBuilder map(java.util.Map<java.lang.String,java.lang.Object> map)
                    throws java.io.IOException
Throws:
java.io.IOException

value

public XContentBuilder value(java.util.Map<java.lang.String,java.lang.Object> map)
                      throws java.io.IOException
Throws:
java.io.IOException

copyCurrentStructure

public XContentBuilder copyCurrentStructure(XContentParser parser)
                                     throws java.io.IOException
Throws:
java.io.IOException

flush

public XContentBuilder flush()
                      throws java.io.IOException
Throws:
java.io.IOException

close

public void close()

payload

@Nullable
public java.lang.Object payload()

stream

public java.io.OutputStream stream()

unsafeBytes

public byte[] unsafeBytes()
                   throws java.io.IOException
Returns the unsafe bytes (thread local bound). Make sure to use it with unsafeBytesLength().

Only applicable when the builder is constructed with FastByteArrayOutputStream.

Throws:
java.io.IOException

unsafeBytesLength

public int unsafeBytesLength()
                      throws java.io.IOException
Returns the unsafe bytes length (thread local bound). Make sure to use it with unsafeBytes().

Only applicable when the builder is constructed with FastByteArrayOutputStream.

Throws:
java.io.IOException

unsafeStream

public BytesStream unsafeStream()
                         throws java.io.IOException
Returns the actual stream used.

Throws:
java.io.IOException

copiedBytes

public byte[] copiedBytes()
                   throws java.io.IOException
Returns a copy of the bytes this builder generated.

Only applicable when the builder is constructed with FastByteArrayOutputStream.

Throws:
java.io.IOException

string

public java.lang.String string()
                        throws java.io.IOException
Returns a string representation of the builder (only applicable for text based xcontent).

Only applicable when the builder is constructed with FastByteArrayOutputStream.

Throws:
java.io.IOException