org.elasticsearch.common.xcontent
Class XContentFactory

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

public class XContentFactory
extends Object

A one stop to use XContent and XContentBuilder.


Constructor Summary
XContentFactory()
           
 
Method Summary
static XContentBuilder contentBuilder(XContentType type)
          Returns a binary content builder for the provided content type.
static XContentBuilder contentBuilder(XContentType type, OutputStream outputStream)
          Constructs a xcontent builder that will output the result into the provided output stream.
static XContentBuilder jsonBuilder()
          Returns a content builder using JSON format (XContentType.JSON.
static XContentBuilder jsonBuilder(OutputStream os)
          Constructs a new json builder that will output the result into the provided output stream.
static XContentBuilder smileBuilder()
          Returns a content builder using SMILE format (XContentType.SMILE.
static XContentBuilder smileBuilder(OutputStream os)
          Constructs a new json builder that will output the result into the provided output stream.
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(BytesReference bytes)
           
static XContent xContent(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(BytesReference bytes)
          Guesses the content type based on the provided bytes.
static XContentType xContentType(CharSequence content)
          Guesses the content type based on the provided char sequence.
static XContentType xContentType(InputStream si)
          Guesses the content type based on the provided input stream.
static XContentBuilder yamlBuilder(OutputStream os)
          Constructs a new yaml builder that will output the result into the provided output stream.
 
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 XContentBuilder jsonBuilder()
                                   throws IOException
Returns a content builder using JSON format (XContentType.JSON.

Throws:
IOException

jsonBuilder

public static XContentBuilder jsonBuilder(OutputStream os)
                                   throws IOException
Constructs a new json builder that will output the result into the provided output stream.

Throws:
IOException

smileBuilder

public static XContentBuilder smileBuilder()
                                    throws IOException
Returns a content builder using SMILE format (XContentType.SMILE.

Throws:
IOException

smileBuilder

public static XContentBuilder smileBuilder(OutputStream os)
                                    throws IOException
Constructs a new json builder that will output the result into the provided output stream.

Throws:
IOException

yamlBuilder

public static XContentBuilder yamlBuilder(OutputStream os)
                                   throws IOException
Constructs a new yaml builder that will output the result into the provided output stream.

Throws:
IOException

contentBuilder

public static XContentBuilder contentBuilder(XContentType type,
                                             OutputStream outputStream)
                                      throws IOException
Constructs a xcontent builder that will output the result into the provided output stream.

Throws:
IOException

contentBuilder

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

Throws:
IOException

xContent

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


xContentType

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


xContent

public static XContent xContent(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(InputStream si)
                                 throws IOException
Guesses the content type based on the provided input stream.

Throws:
IOException

xContentType

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


xContent

public static XContent xContent(BytesReference bytes)

xContentType

public static XContentType xContentType(BytesReference bytes)
Guesses the content type based on the provided bytes.



Copyright © 2009-2012. All Rights Reserved.