java.lang.AutoCloseable, java.io.CloseableAbstractXContentParser, CborXContentParser, JsonXContentParser, SmileXContentParser, YamlXContentParserpublic interface XContentParser
extends java.io.Closeable
XContent see XContentType for supported types.
To obtain an instance of this class use the following pattern:
XContentType xContentType = XContentType.JSON;
XContentParser parser = xContentType.xContent().createParser(
NamedXContentRegistry.EMPTY, ParserField."{\"key\" : \"value\"}");
| Modifier and Type | Interface | Description |
|---|---|---|
static class |
XContentParser.NumberType |
|
static class |
XContentParser.Token |
| Modifier and Type | Method | Description |
|---|---|---|
byte[] |
binaryValue() |
Reads a plain binary value that was written via one of the following methods:
XContentBuilder.field(String, byte[], int, int)}
XContentBuilder.field(String, byte[])}
as well as via their String variants of the separated value methods. |
boolean |
booleanValue() |
|
boolean |
booleanValueLenient() |
Deprecated.
Just present for providing backwards compatibility.
|
java.nio.CharBuffer |
charBuffer() |
Returns a
CharBuffer holding UTF-8 bytes. |
java.nio.CharBuffer |
charBufferOrNull() |
|
XContentType |
contentType() |
|
java.lang.String |
currentName() |
|
XContentParser.Token |
currentToken() |
|
double |
doubleValue() |
|
double |
doubleValue(boolean coerce) |
|
float |
floatValue() |
|
float |
floatValue(boolean coerce) |
|
DeprecationHandler |
getDeprecationHandler() |
The callback to notify when parsing encounters a deprecated field.
|
XContentLocation |
getTokenLocation() |
Used for error reporting to highlight where syntax errors occur in
content being parsed.
|
NamedXContentRegistry |
getXContentRegistry() |
The registry used to resolve
namedObject(Class, String, Object). |
boolean |
hasTextCharacters() |
Method that can be used to determine whether calling of textCharacters() would be the most efficient way to
access textual content for the event parser currently points to.
|
int |
intValue() |
|
int |
intValue(boolean coerce) |
|
boolean |
isBooleanValue() |
|
boolean |
isBooleanValueLenient() |
Deprecated.
Just present for providing backwards compatibility.
|
boolean |
isClosed() |
|
java.util.List<java.lang.Object> |
list() |
|
java.util.List<java.lang.Object> |
listOrderedMap() |
|
long |
longValue() |
|
long |
longValue(boolean coerce) |
|
java.util.Map<java.lang.String,java.lang.Object> |
map() |
|
java.util.Map<java.lang.String,java.lang.Object> |
mapOrdered() |
|
java.util.Map<java.lang.String,java.lang.String> |
mapStrings() |
|
java.util.Map<java.lang.String,java.lang.String> |
mapStringsOrdered() |
|
<T> T |
namedObject(java.lang.Class<T> categoryClass,
java.lang.String name,
java.lang.Object context) |
Parse an object by name.
|
XContentParser.Token |
nextToken() |
|
XContentParser.NumberType |
numberType() |
|
java.lang.Number |
numberValue() |
|
java.lang.Object |
objectBytes() |
|
java.lang.Object |
objectText() |
|
short |
shortValue() |
|
short |
shortValue(boolean coerce) |
|
void |
skipChildren() |
|
java.lang.String |
text() |
|
char[] |
textCharacters() |
|
int |
textLength() |
|
int |
textOffset() |
|
java.lang.String |
textOrNull() |
XContentType contentType()
XContentParser.Token nextToken() throws java.io.IOException
java.io.IOExceptionvoid skipChildren()
throws java.io.IOException
java.io.IOExceptionXContentParser.Token currentToken()
java.lang.String currentName()
throws java.io.IOException
java.io.IOExceptionjava.util.Map<java.lang.String,java.lang.Object> map()
throws java.io.IOException
java.io.IOExceptionjava.util.Map<java.lang.String,java.lang.Object> mapOrdered()
throws java.io.IOException
java.io.IOExceptionjava.util.Map<java.lang.String,java.lang.String> mapStrings()
throws java.io.IOException
java.io.IOExceptionjava.util.Map<java.lang.String,java.lang.String> mapStringsOrdered()
throws java.io.IOException
java.io.IOExceptionjava.util.List<java.lang.Object> list()
throws java.io.IOException
java.io.IOExceptionjava.util.List<java.lang.Object> listOrderedMap()
throws java.io.IOException
java.io.IOExceptionjava.lang.String text()
throws java.io.IOException
java.io.IOExceptionjava.lang.String textOrNull()
throws java.io.IOException
java.io.IOExceptionjava.nio.CharBuffer charBufferOrNull()
throws java.io.IOException
java.io.IOExceptionjava.nio.CharBuffer charBuffer()
throws java.io.IOException
CharBuffer holding UTF-8 bytes.
This method should be used to read text only binary content should be read through binaryValue()java.io.IOExceptionjava.lang.Object objectText()
throws java.io.IOException
java.io.IOExceptionjava.lang.Object objectBytes()
throws java.io.IOException
java.io.IOExceptionboolean hasTextCharacters()
char[] textCharacters()
throws java.io.IOException
java.io.IOExceptionint textLength()
throws java.io.IOException
java.io.IOExceptionint textOffset()
throws java.io.IOException
java.io.IOExceptionjava.lang.Number numberValue()
throws java.io.IOException
java.io.IOExceptionXContentParser.NumberType numberType() throws java.io.IOException
java.io.IOExceptionshort shortValue(boolean coerce)
throws java.io.IOException
java.io.IOExceptionint intValue(boolean coerce)
throws java.io.IOException
java.io.IOExceptionlong longValue(boolean coerce)
throws java.io.IOException
java.io.IOExceptionfloat floatValue(boolean coerce)
throws java.io.IOException
java.io.IOExceptiondouble doubleValue(boolean coerce)
throws java.io.IOException
java.io.IOExceptionshort shortValue()
throws java.io.IOException
java.io.IOExceptionint intValue()
throws java.io.IOException
java.io.IOExceptionlong longValue()
throws java.io.IOException
java.io.IOExceptionfloat floatValue()
throws java.io.IOException
java.io.IOExceptiondouble doubleValue()
throws java.io.IOException
java.io.IOExceptionboolean isBooleanValue()
throws java.io.IOException
true or false) or one of "false", "true".java.io.IOExceptionboolean booleanValue()
throws java.io.IOException
java.io.IOException@Deprecated
boolean isBooleanValueLenient()
throws java.io.IOException
isBooleanValue() instead.java.io.IOException@Deprecated
boolean booleanValueLenient()
throws java.io.IOException
booleanValue() instead.java.io.IOExceptionbyte[] binaryValue()
throws java.io.IOException
String variants of the separated value methods.
Note: Do not use this method to read values written with:
these methods write UTF-8 encoded strings and must be read through:
text() ()}textOrNull() ()}textCharacters() ()}}java.io.IOExceptionXContentLocation getTokenLocation()
<T> T namedObject(java.lang.Class<T> categoryClass,
java.lang.String name,
java.lang.Object context)
throws java.io.IOException
java.io.IOExceptionNamedXContentRegistry getXContentRegistry()
namedObject(Class, String, Object). Use this when building a sub-parser from this parser.boolean isClosed()
DeprecationHandler getDeprecationHandler()