public interface XContentParser extends Releasable
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("{\"key\" : \"value\"}");
| Modifier and Type | Interface and Description |
|---|---|
static class |
XContentParser.NumberType |
static class |
XContentParser.Token |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
binaryValue()
Reads a plain binary value that was written via one of the following methods:
XContentBuilder.field(String, org.apache.lucene.util.BytesRef)
XContentBuilder.field(String, org.elasticsearch.common.bytes.BytesReference)
XContentBuilder.field(String, byte[], int, int)}
XContentBuilder.field(String, byte[])}
as well as via their XContentBuilderString variants of the separated value methods. |
boolean |
booleanValue() |
XContentType |
contentType() |
String |
currentName() |
XContentParser.Token |
currentToken() |
double |
doubleValue() |
double |
doubleValue(boolean coerce) |
float |
floatValue() |
float |
floatValue(boolean coerce) |
XContentLocation |
getTokenLocation()
Used for error reporting to highlight where syntax errors occur in
content being parsed.
|
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()
returns true if the current value is boolean in nature.
|
boolean |
isClosed() |
List<Object> |
list() |
List<Object> |
listOrderedMap() |
long |
longValue() |
long |
longValue(boolean coerce) |
Map<String,Object> |
map() |
Map<String,Object> |
mapOrdered() |
XContentParser.Token |
nextToken() |
XContentParser.NumberType |
numberType() |
Number |
numberValue() |
Object |
objectBytes() |
Object |
objectText() |
short |
shortValue() |
short |
shortValue(boolean coerce) |
void |
skipChildren() |
String |
text() |
char[] |
textCharacters() |
int |
textLength() |
int |
textOffset() |
String |
textOrNull() |
org.apache.lucene.util.BytesRef |
utf8Bytes()
Returns a BytesRef holding UTF-8 bytes.
|
org.apache.lucene.util.BytesRef |
utf8BytesOrNull()
Returns a BytesRef holding UTF-8 bytes or null if a null value is
XContentParser.Token.VALUE_NULL. |
closeXContentType contentType()
XContentParser.Token nextToken() throws IOException
IOExceptionvoid skipChildren()
throws IOException
IOExceptionXContentParser.Token currentToken()
String currentName() throws IOException
IOExceptionMap<String,Object> map() throws IOException
IOExceptionMap<String,Object> mapOrdered() throws IOException
IOExceptionList<Object> list() throws IOException
IOExceptionList<Object> listOrderedMap() throws IOException
IOExceptionString text() throws IOException
IOExceptionString textOrNull() throws IOException
IOExceptionorg.apache.lucene.util.BytesRef utf8BytesOrNull()
throws IOException
XContentParser.Token.VALUE_NULL.
This method should be used to read text only binary content should be read through binaryValue()IOExceptionorg.apache.lucene.util.BytesRef utf8Bytes()
throws IOException
binaryValue()IOExceptionObject objectText() throws IOException
IOExceptionObject objectBytes() throws IOException
IOExceptionboolean hasTextCharacters()
char[] textCharacters()
throws IOException
IOExceptionint textLength()
throws IOException
IOExceptionint textOffset()
throws IOException
IOExceptionNumber numberValue() throws IOException
IOExceptionXContentParser.NumberType numberType() throws IOException
IOExceptionshort shortValue(boolean coerce)
throws IOException
IOExceptionint intValue(boolean coerce)
throws IOException
IOExceptionlong longValue(boolean coerce)
throws IOException
IOExceptionfloat floatValue(boolean coerce)
throws IOException
IOExceptiondouble doubleValue(boolean coerce)
throws IOException
IOExceptionshort shortValue()
throws IOException
IOExceptionint intValue()
throws IOException
IOExceptionlong longValue()
throws IOException
IOExceptionfloat floatValue()
throws IOException
IOExceptiondouble doubleValue()
throws IOException
IOExceptionboolean isBooleanValue()
throws IOException
IOExceptionboolean booleanValue()
throws IOException
IOExceptionbyte[] binaryValue()
throws IOException
XContentBuilder.field(String, org.apache.lucene.util.BytesRef)XContentBuilder.field(String, org.elasticsearch.common.bytes.BytesReference)XContentBuilder.field(String, byte[], int, int)}XContentBuilder.field(String, byte[])}XContentBuilderString variants of the separated value methods.
Note: Do not use this method to read values written with:
XContentBuilder.utf8Field(XContentBuilderString, org.apache.lucene.util.BytesRef)XContentBuilder.utf8Field(String, org.apache.lucene.util.BytesRef)utf8Bytes()utf8BytesOrNull()}text() ()}textOrNull() ()}textCharacters() ()}}IOExceptionXContentLocation getTokenLocation()
boolean isClosed()
Copyright © 2009–2016. All rights reserved.