public interface XContent
A generic abstraction on top of handling content, inspired by JSON and pull parsing.
-
Method Summary
Modifier and TypeMethodDescriptionbyte
default 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.default XContentParser
createParser
(NamedXContentRegistry registry, DeprecationHandler deprecationHandler, InputStream is) Deprecated.default XContentParser
createParser
(XContentParserConfiguration config, byte[] data) Creates a parser over the provided bytes.createParser
(XContentParserConfiguration config, byte[] data, int offset, int length) Creates a parser over the provided bytes.createParser
(XContentParserConfiguration config, InputStream is) Creates a parser over the provided input stream.createParser
(XContentParserConfiguration config, Reader reader) Creates a parser over the provided reader.createParser
(XContentParserConfiguration config, String content) Creates a parser over the provided string content.boolean
detectContent
(byte[] bytes, int offset, int length) Deprecated.boolean
detectContent
(CharSequence chars) Deprecated.type()
The type this content handles and produces.
-
Method Details
-
type
XContentType type()The type this content handles and produces. -
bulkSeparator
byte bulkSeparator() -
detectContent
Deprecated. -
detectContent
Deprecated. -
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
Creates a parser over the provided string content.- Throws:
IOException
-
createParser
Creates a parser over the provided input stream.- Throws:
IOException
-
createParser
@Deprecated default XContentParser createParser(NamedXContentRegistry registry, DeprecationHandler deprecationHandler, InputStream is) throws IOException Deprecated.Creates a parser over the provided input stream.- Throws:
IOException
-
createParser
default XContentParser createParser(XContentParserConfiguration config, byte[] data) throws IOException Creates a parser over the provided bytes.- Throws:
IOException
-
createParser
XContentParser createParser(XContentParserConfiguration config, byte[] data, int offset, int length) throws IOException Creates a parser over the provided bytes.- Throws:
IOException
-
createParser
Creates a parser over the provided reader.- Throws:
IOException
-
createParser(XContentParserConfiguration, InputStream)