Class XContentFactory

java.lang.Object
org.opensearch.common.xcontent.XContentFactory

public class XContentFactory extends Object
A one stop to use XContent and XContentBuilder.
  • Constructor Details

    • XContentFactory

      public XContentFactory()
  • Method Details

    • jsonBuilder

      public static org.opensearch.core.xcontent.XContentBuilder jsonBuilder() throws IOException
      Returns a content builder using JSON format (XContentType.JSON.
      Throws:
      IOException
    • jsonBuilder

      public static org.opensearch.core.xcontent.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 org.opensearch.core.xcontent.XContentBuilder smileBuilder() throws IOException
      Returns a content builder using SMILE format (XContentType.SMILE.
      Throws:
      IOException
    • smileBuilder

      public static org.opensearch.core.xcontent.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 org.opensearch.core.xcontent.XContentBuilder yamlBuilder() throws IOException
      Returns a content builder using YAML format (XContentType.YAML.
      Throws:
      IOException
    • yamlBuilder

      public static org.opensearch.core.xcontent.XContentBuilder yamlBuilder(OutputStream os) throws IOException
      Constructs a new yaml builder that will output the result into the provided output stream.
      Throws:
      IOException
    • cborBuilder

      public static org.opensearch.core.xcontent.XContentBuilder cborBuilder() throws IOException
      Returns a content builder using CBOR format (XContentType.CBOR.
      Throws:
      IOException