Package org.opensearch.common.xcontent
Class XContentFactory
java.lang.Object
org.opensearch.common.xcontent.XContentFactory
A one stop to use
XContent and XContentBuilder.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.opensearch.core.xcontent.XContentBuilderReturns a content builder using CBOR format (XContentType.CBOR.static org.opensearch.core.xcontent.XContentBuilderReturns a content builder using JSON format (XContentType.JSON.static org.opensearch.core.xcontent.XContentBuilderConstructs a new json builder that will output the result into the provided output stream.static org.opensearch.core.xcontent.XContentBuilderReturns a content builder using SMILE format (XContentType.SMILE.static org.opensearch.core.xcontent.XContentBuilderConstructs a new json builder that will output the result into the provided output stream.static org.opensearch.core.xcontent.XContentBuilderReturns a content builder using YAML format (XContentType.YAML.static org.opensearch.core.xcontent.XContentBuilderConstructs a new yaml builder that will output the result into the provided output stream.
-
Constructor Details
-
XContentFactory
public XContentFactory()
-
-
Method Details
-
jsonBuilder
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
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
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
Returns a content builder using CBOR format (XContentType.CBOR.- Throws:
IOException
-