org.elasticsearch.util.xcontent
Class XContentFactory

java.lang.Object
  extended by org.elasticsearch.util.xcontent.XContentFactory

public class XContentFactory
extends java.lang.Object

A one stop to use XContent and XContentBuilder.


Constructor Summary
XContentFactory()
           
 
Method Summary
static BinaryXContentBuilder contentBinaryBuilder(XContentType type)
          Returns a binary content builder for the provided content type.
static BinaryXContentBuilder contentBuilder(XContentType type)
          Returns a binary content builder for the provided content type.
static TextXContentBuilder contentTextBuilder(XContentType type)
          Returns a textual content builder for the provided content type.
static BinaryXContentBuilder jsonBuilder()
          Returns a binary content builder using JSON format (XContentType.JSON.
static XContent xContent(byte[] data)
          Guesses the content type based on the provided bytes.
static XContent xContent(byte[] data, int offset, int length)
          Guesses the content type based on the provided bytes.
static XContent xContent(java.lang.CharSequence content)
          Guesses the content (type) based on the provided char sequence.
static XContent xContent(XContentType type)
          Returns the XContent for the provided content type.
static XContentType xContentType(byte[] data)
          Guesses the content type based on the provided bytes.
static XContentType xContentType(byte[] data, int offset, int length)
          Guesses the content type based on the provided bytes.
static XContentType xContentType(java.lang.CharSequence content)
          Guesses the content type based on the provided char sequence.
static BinaryXContentBuilder xsonBuilder()
          Returns a binary content builder using XSON format (XContentType.XSON.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XContentFactory

public XContentFactory()
Method Detail

jsonBuilder

public static BinaryXContentBuilder jsonBuilder()
                                         throws java.io.IOException
Returns a binary content builder using JSON format (XContentType.JSON.

Throws:
java.io.IOException

xsonBuilder

public static BinaryXContentBuilder xsonBuilder()
                                         throws java.io.IOException
Returns a binary content builder using XSON format (XContentType.XSON.

Throws:
java.io.IOException

contentBuilder

public static BinaryXContentBuilder contentBuilder(XContentType type)
                                            throws java.io.IOException
Returns a binary content builder for the provided content type.

Throws:
java.io.IOException

contentBinaryBuilder

public static BinaryXContentBuilder contentBinaryBuilder(XContentType type)
                                                  throws java.io.IOException
Returns a binary content builder for the provided content type.

Throws:
java.io.IOException

contentTextBuilder

public static TextXContentBuilder contentTextBuilder(XContentType type)
                                              throws java.io.IOException
Returns a textual content builder for the provided content type. Note, XSON does not support this... .

Throws:
java.io.IOException

xContent

public static XContent xContent(XContentType type)
Returns the XContent for the provided content type.


xContentType

public static XContentType xContentType(java.lang.CharSequence content)
Guesses the content type based on the provided char sequence.


xContent

public static XContent xContent(java.lang.CharSequence content)
Guesses the content (type) based on the provided char sequence.


xContent

public static XContent xContent(byte[] data)
Guesses the content type based on the provided bytes.


xContent

public static XContent xContent(byte[] data,
                                int offset,
                                int length)
Guesses the content type based on the provided bytes.


xContentType

public static XContentType xContentType(byte[] data)
Guesses the content type based on the provided bytes.


xContentType

public static XContentType xContentType(byte[] data,
                                        int offset,
                                        int length)
Guesses the content type based on the provided bytes.