Package org.elasticsearch.xcontent
Interface XContent
- All Known Implementing Classes:
CborXContent
,JsonXContent
,SmileXContent
,YamlXContent
public interface XContent
A generic abstraction on top of handling content, inspired by JSON and pull parsing.
-
Method Summary
Modifier and TypeMethodDescriptiondefault XContentGenerator
Creates a new generator using the provided output stream.createGenerator
(OutputStream os, Set<String> includes, Set<String> excludes) Creates a new generator using the provided output stream and some inclusive and/or exclusive filters.createParser
(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, byte[] data) Creates a parser over the provided bytes.createParser
(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, byte[] data, int offset, int length) Creates a parser over the provided bytes.createParser
(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, InputStream is) Creates a parser over the provided input stream.createParser
(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, InputStream is, FilterPath[] includes, FilterPath[] excludes) Creates a parser over the provided input stream.createParser
(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, Reader reader) Creates a parser over the provided reader.createParser
(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, String content) Creates a parser over the provided string content.byte
type()
The type this content handles and produces.
-
Method Details
-
type
XContentType type()The type this content handles and produces. -
streamSeparator
byte streamSeparator() -
createGenerator
Creates a new generator using the provided output stream.- Throws:
IOException
-
createGenerator
XContentGenerator createGenerator(OutputStream os, Set<String> includes, Set<String> excludes) throws IOException Creates a new generator using the provided output stream and some inclusive and/or exclusive filters. When both exclusive and inclusive filters are provided, the underlying generator will first use exclusion filters to remove fields and then will check the remaining fields against the inclusive filters.- Parameters:
os
- the output streamincludes
- the inclusive filters: only fields and objects that match the inclusive filters will be written to the output.excludes
- the exclusive filters: only fields and objects that don't match the exclusive filters will be written to the output.- Throws:
IOException
-
createParser
XContentParser createParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, String content) throws IOException Creates a parser over the provided string content.- Throws:
IOException
-
createParser
XContentParser createParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, InputStream is) throws IOException Creates a parser over the provided input stream.- Throws:
IOException
-
createParser
XContentParser createParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, InputStream is, FilterPath[] includes, FilterPath[] excludes) throws IOException Creates a parser over the provided input stream.- Throws:
IOException
-
createParser
XContentParser createParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, byte[] data) throws IOException Creates a parser over the provided bytes.- Throws:
IOException
-
createParser
XContentParser createParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, byte[] data, int offset, int length) throws IOException Creates a parser over the provided bytes.- Throws:
IOException
-
createParser
XContentParser createParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, Reader reader) throws IOException Creates a parser over the provided reader.- Throws:
IOException
-