Class JsonXContentParser
- java.lang.Object
-
- org.elasticsearch.common.xcontent.support.AbstractXContentParser
-
- org.elasticsearch.common.xcontent.json.JsonXContentParser
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,XContentParser
- Direct Known Subclasses:
CborXContentParser,SmileXContentParser,YamlXContentParser
public class JsonXContentParser extends AbstractXContentParser
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.XContentParser
XContentParser.NumberType, XContentParser.Token
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.common.xcontent.support.AbstractXContentParser
DEFAULT_NUMBER_COERCE_POLICY
-
-
Constructor Summary
Constructors Constructor Description JsonXContentParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, com.fasterxml.jackson.core.JsonParser parser)
-
Method Summary
All Methods Instance Methods Concrete Methods 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 theirStringvariants of the separated value methods.java.nio.CharBuffercharBuffer()Returns aCharBufferholding UTF-8 bytes.voidclose()XContentTypecontentType()java.lang.StringcurrentName()XContentParser.TokencurrentToken()protected booleandoBooleanValue()doubledoDoubleValue()floatdoFloatValue()intdoIntValue()longdoLongValue()shortdoShortValue()XContentLocationgetTokenLocation()Used for error reporting to highlight where syntax errors occur in content being parsed.booleanhasTextCharacters()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.booleanisClosed()XContentParser.TokennextToken()XContentParser.NumberTypenumberType()java.lang.NumbernumberValue()java.lang.ObjectobjectBytes()java.lang.ObjectobjectText()voidskipChildren()java.lang.Stringtext()char[]textCharacters()inttextLength()inttextOffset()-
Methods inherited from class org.elasticsearch.common.xcontent.support.AbstractXContentParser
booleanValue, booleanValueLenient, charBufferOrNull, doubleValue, doubleValue, floatValue, floatValue, getDeprecationHandler, getXContentRegistry, intValue, intValue, isBooleanValue, isBooleanValueLenient, list, listOrderedMap, longValue, longValue, map, mapOrdered, mapStrings, mapStringsOrdered, namedObject, shortValue, shortValue, textOrNull
-
-
-
-
Constructor Detail
-
JsonXContentParser
public JsonXContentParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, com.fasterxml.jackson.core.JsonParser parser)
-
-
Method Detail
-
contentType
public XContentType contentType()
-
nextToken
public XContentParser.Token nextToken() throws java.io.IOException
- Throws:
java.io.IOException
-
skipChildren
public void skipChildren() throws java.io.IOException- Throws:
java.io.IOException
-
currentToken
public XContentParser.Token currentToken()
-
numberType
public XContentParser.NumberType numberType() throws java.io.IOException
- Throws:
java.io.IOException
-
currentName
public java.lang.String currentName() throws java.io.IOException- Throws:
java.io.IOException
-
doBooleanValue
protected boolean doBooleanValue() throws java.io.IOException- Specified by:
doBooleanValuein classAbstractXContentParser- Throws:
java.io.IOException
-
text
public java.lang.String text() throws java.io.IOException- Throws:
java.io.IOException
-
charBuffer
public java.nio.CharBuffer charBuffer() throws java.io.IOExceptionDescription copied from interface:XContentParserReturns aCharBufferholding UTF-8 bytes. This method should be used to read text only binary content should be read throughXContentParser.binaryValue()- Throws:
java.io.IOException
-
objectText
public java.lang.Object objectText() throws java.io.IOException- Throws:
java.io.IOException
-
objectBytes
public java.lang.Object objectBytes() throws java.io.IOException- Throws:
java.io.IOException
-
hasTextCharacters
public boolean hasTextCharacters()
Description copied from interface:XContentParserMethod 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. Default implementation simply returns false since only actual implementation class has knowledge of its internal buffering state. This method shouldn't be used to check if the token contains text or not.
-
textCharacters
public char[] textCharacters() throws java.io.IOException- Throws:
java.io.IOException
-
textLength
public int textLength() throws java.io.IOException- Throws:
java.io.IOException
-
textOffset
public int textOffset() throws java.io.IOException- Throws:
java.io.IOException
-
numberValue
public java.lang.Number numberValue() throws java.io.IOException- Throws:
java.io.IOException
-
doShortValue
public short doShortValue() throws java.io.IOException- Specified by:
doShortValuein classAbstractXContentParser- Throws:
java.io.IOException
-
doIntValue
public int doIntValue() throws java.io.IOException- Specified by:
doIntValuein classAbstractXContentParser- Throws:
java.io.IOException
-
doLongValue
public long doLongValue() throws java.io.IOException- Specified by:
doLongValuein classAbstractXContentParser- Throws:
java.io.IOException
-
doFloatValue
public float doFloatValue() throws java.io.IOException- Specified by:
doFloatValuein classAbstractXContentParser- Throws:
java.io.IOException
-
doDoubleValue
public double doDoubleValue() throws java.io.IOException- Specified by:
doDoubleValuein classAbstractXContentParser- Throws:
java.io.IOException
-
binaryValue
public byte[] binaryValue() throws java.io.IOExceptionDescription copied from interface:XContentParserReads a plain binary value that was written via one of the following methods: as well as via theirStringvariants 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:- Throws:
java.io.IOException
-
getTokenLocation
public XContentLocation getTokenLocation()
Description copied from interface:XContentParserUsed for error reporting to highlight where syntax errors occur in content being parsed.- Returns:
- last token's location or null if cannot be determined
-
close
public void close()
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceXContentParser- Specified by:
isClosedin classAbstractXContentParser
-
-