|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.JsonParser
org.codehaus.jackson.impl.JsonParserMinimalBase
com.fasterxml.jackson.xml.deser.FromXmlParser
public class FromXmlParser
JsonParser
implementation that exposes XML structure as
set of JSON events that can be used for data binding.
Nested Class Summary | |
---|---|
static class |
FromXmlParser.Feature
Enumeration that defines all togglable features for XML parsers |
Nested classes/interfaces inherited from class org.codehaus.jackson.JsonParser |
---|
org.codehaus.jackson.JsonParser.NumberType |
Field Summary | |
---|---|
protected byte[] |
_binaryValue
We will hold on to decoded binary data, for duration of current event, so that multiple calls to getBinaryValue(org.codehaus.jackson.Base64Variant) will not need to decode data more
than once. |
protected org.codehaus.jackson.util.ByteArrayBuilder |
_byteArrayBuilder
ByteArrayBuilder is needed if 'getBinaryValue' is called. |
protected boolean |
_closed
Flag that indicates whether parser is closed or not. |
protected String |
_currText
|
protected org.codehaus.jackson.io.IOContext |
_ioContext
|
protected boolean |
_mayBeLeaf
We need special handling to keep track of whether a value may be exposed as simple leaf value. |
protected org.codehaus.jackson.JsonToken |
_nextToken
|
protected org.codehaus.jackson.ObjectCodec |
_objectCodec
|
protected org.codehaus.jackson.impl.JsonReadContext |
_parsingContext
Information about parser context, context in which the next token is to be parsed (root, array, object). |
protected int |
_xmlFeatures
Bit flag composed of bits that indicate which FromXmlParser.Feature s
are enabled. |
protected XmlTokenStream |
_xmlTokens
|
protected static String |
UNNAMED_TEXT_PROPERTY
In cases where a start element has both attributes and non-empty textual value, we have to create a bogus property; we will use this as the property name. |
Fields inherited from class org.codehaus.jackson.impl.JsonParserMinimalBase |
---|
INT_APOSTROPHE, INT_ASTERISK, INT_b, INT_BACKSLASH, INT_COLON, INT_COMMA, INT_CR, INT_f, INT_LBRACKET, INT_LCURLY, INT_LF, INT_n, INT_QUOTE, INT_r, INT_RBRACKET, INT_RCURLY, INT_SLASH, INT_SPACE, INT_t, INT_TAB, INT_u |
Fields inherited from class org.codehaus.jackson.JsonParser |
---|
_currToken, _features, _lastClearedToken |
Constructor Summary | |
---|---|
FromXmlParser(org.codehaus.jackson.io.IOContext ctxt,
int genericParserFeatures,
int xmlFeatures,
org.codehaus.jackson.ObjectCodec codec,
XMLStreamReader xmlReader)
|
Method Summary | |
---|---|
protected byte[] |
_decodeBase64(org.codehaus.jackson.Base64Variant b64variant)
|
protected org.codehaus.jackson.util.ByteArrayBuilder |
_getByteArrayBuilder()
|
protected void |
_handleEOF()
Method called when an EOF is encountered between tokens. |
protected void |
_releaseBuffers()
Method called to release internal buffers owned by the base parser. |
protected void |
_reportBase64EOF()
|
protected void |
_reportInvalidBase64(org.codehaus.jackson.Base64Variant b64variant,
char ch,
int bindex,
String msg)
|
void |
close()
|
FromXmlParser |
configure(FromXmlParser.Feature f,
boolean state)
|
FromXmlParser |
disable(FromXmlParser.Feature f)
|
FromXmlParser |
enable(FromXmlParser.Feature f)
|
BigInteger |
getBigIntegerValue()
|
byte[] |
getBinaryValue(org.codehaus.jackson.Base64Variant b64variant)
|
org.codehaus.jackson.ObjectCodec |
getCodec()
|
org.codehaus.jackson.JsonLocation |
getCurrentLocation()
Method that returns location of the last processed character; usually for error reporting purposes |
String |
getCurrentName()
Method that can be called to get the name associated with the current event. |
BigDecimal |
getDecimalValue()
|
double |
getDoubleValue()
|
float |
getFloatValue()
|
int |
getIntValue()
|
long |
getLongValue()
|
org.codehaus.jackson.JsonParser.NumberType |
getNumberType()
|
Number |
getNumberValue()
|
org.codehaus.jackson.impl.JsonReadContext |
getParsingContext()
|
XMLStreamReader |
getStaxReader()
Method that allows application direct access to underlying Stax XMLStreamWriter . |
String |
getText()
|
char[] |
getTextCharacters()
|
int |
getTextLength()
|
int |
getTextOffset()
|
org.codehaus.jackson.JsonLocation |
getTokenLocation()
Method that return the starting location of the current token; that is, position of the first character from input that starts the current token. |
boolean |
hasTextCharacters()
XML input actually would offer access to character arrays; but since we must coalesce things it cannot really be exposed. |
boolean |
isClosed()
|
boolean |
isEnabled(FromXmlParser.Feature f)
|
boolean |
isExpectedStartArrayToken()
Since xml representation can not really distinguish between array and object starts (both are represented with elements), this method is overridden and taken to mean that expecation is that the current start element is to mean 'start array', instead of default of 'start object'. |
org.codehaus.jackson.JsonToken |
nextToken()
|
void |
setCodec(org.codehaus.jackson.ObjectCodec c)
|
Methods inherited from class org.codehaus.jackson.impl.JsonParserMinimalBase |
---|
_constructError, _getCharDesc, _handleUnrecognizedCharacterEscape, _reportError, _reportInvalidEOF, _reportInvalidEOF, _reportUnexpectedChar, _throwInternal, _throwInvalidSpace, _throwUnquotedSpace, _wrapError, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, skipChildren |
Methods inherited from class org.codehaus.jackson.JsonParser |
---|
_constructError, clearCurrentToken, configure, disable, disableFeature, enable, enableFeature, getBinaryValue, getBooleanValue, getByteValue, getCurrentToken, getEmbeddedObject, getLastClearedToken, getShortValue, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, hasCurrentToken, isEnabled, isFeatureEnabled, nextValue, readValueAs, readValueAs, readValueAsTree, releaseBuffered, releaseBuffered, setFeature, version |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String UNNAMED_TEXT_PROPERTY
protected int _xmlFeatures
FromXmlParser.Feature
s
are enabled.
protected org.codehaus.jackson.ObjectCodec _objectCodec
protected boolean _closed
close()
) or when end-of-input is reached.
protected final org.codehaus.jackson.io.IOContext _ioContext
protected org.codehaus.jackson.impl.JsonReadContext _parsingContext
protected final XmlTokenStream _xmlTokens
protected boolean _mayBeLeaf
protected org.codehaus.jackson.JsonToken _nextToken
protected String _currText
protected org.codehaus.jackson.util.ByteArrayBuilder _byteArrayBuilder
protected byte[] _binaryValue
getBinaryValue(org.codehaus.jackson.Base64Variant)
will not need to decode data more
than once.
Constructor Detail |
---|
public FromXmlParser(org.codehaus.jackson.io.IOContext ctxt, int genericParserFeatures, int xmlFeatures, org.codehaus.jackson.ObjectCodec codec, XMLStreamReader xmlReader)
Method Detail |
---|
public org.codehaus.jackson.ObjectCodec getCodec()
getCodec
in class org.codehaus.jackson.JsonParser
public void setCodec(org.codehaus.jackson.ObjectCodec c)
setCodec
in class org.codehaus.jackson.JsonParser
public FromXmlParser enable(FromXmlParser.Feature f)
public FromXmlParser disable(FromXmlParser.Feature f)
public final boolean isEnabled(FromXmlParser.Feature f)
public FromXmlParser configure(FromXmlParser.Feature f, boolean state)
public XMLStreamReader getStaxReader()
XMLStreamWriter
. Note that use of writer is
discouraged, and may interfere with processing of this writer;
however, occasionally it may be necessary.
Note: writer instance will always be of type
XMLStreamWriter2
(including
Typed Access API) so upcasts are safe.
public String getCurrentName() throws IOException, org.codehaus.jackson.JsonParseException
getCurrentName
in class org.codehaus.jackson.impl.JsonParserMinimalBase
IOException
org.codehaus.jackson.JsonParseException
public void close() throws IOException
close
in interface Closeable
close
in class org.codehaus.jackson.impl.JsonParserMinimalBase
IOException
public boolean isClosed()
isClosed
in class org.codehaus.jackson.impl.JsonParserMinimalBase
public org.codehaus.jackson.impl.JsonReadContext getParsingContext()
getParsingContext
in class org.codehaus.jackson.impl.JsonParserMinimalBase
public org.codehaus.jackson.JsonLocation getTokenLocation()
getTokenLocation
in class org.codehaus.jackson.JsonParser
public org.codehaus.jackson.JsonLocation getCurrentLocation()
getCurrentLocation
in class org.codehaus.jackson.JsonParser
public boolean isExpectedStartArrayToken()
isExpectedStartArrayToken
in class org.codehaus.jackson.JsonParser
public org.codehaus.jackson.JsonToken nextToken() throws IOException, org.codehaus.jackson.JsonParseException
nextToken
in class org.codehaus.jackson.impl.JsonParserMinimalBase
IOException
org.codehaus.jackson.JsonParseException
public String getText() throws IOException, org.codehaus.jackson.JsonParseException
getText
in class org.codehaus.jackson.impl.JsonParserMinimalBase
IOException
org.codehaus.jackson.JsonParseException
public char[] getTextCharacters() throws IOException, org.codehaus.jackson.JsonParseException
getTextCharacters
in class org.codehaus.jackson.impl.JsonParserMinimalBase
IOException
org.codehaus.jackson.JsonParseException
public int getTextLength() throws IOException, org.codehaus.jackson.JsonParseException
getTextLength
in class org.codehaus.jackson.impl.JsonParserMinimalBase
IOException
org.codehaus.jackson.JsonParseException
public int getTextOffset() throws IOException, org.codehaus.jackson.JsonParseException
getTextOffset
in class org.codehaus.jackson.impl.JsonParserMinimalBase
IOException
org.codehaus.jackson.JsonParseException
public boolean hasTextCharacters()
hasTextCharacters
in class org.codehaus.jackson.impl.JsonParserMinimalBase
public byte[] getBinaryValue(org.codehaus.jackson.Base64Variant b64variant) throws IOException, org.codehaus.jackson.JsonParseException
getBinaryValue
in class org.codehaus.jackson.impl.JsonParserMinimalBase
IOException
org.codehaus.jackson.JsonParseException
protected byte[] _decodeBase64(org.codehaus.jackson.Base64Variant b64variant) throws IOException, org.codehaus.jackson.JsonParseException
IOException
org.codehaus.jackson.JsonParseException
protected void _reportInvalidBase64(org.codehaus.jackson.Base64Variant b64variant, char ch, int bindex, String msg) throws org.codehaus.jackson.JsonParseException
bindex
- Relative index within base64 character unit; between 0
and 3 (as unit has exactly 4 characters)
org.codehaus.jackson.JsonParseException
protected void _reportBase64EOF() throws org.codehaus.jackson.JsonParseException
org.codehaus.jackson.JsonParseException
public BigInteger getBigIntegerValue() throws IOException, org.codehaus.jackson.JsonParseException
getBigIntegerValue
in class org.codehaus.jackson.JsonParser
IOException
org.codehaus.jackson.JsonParseException
public BigDecimal getDecimalValue() throws IOException, org.codehaus.jackson.JsonParseException
getDecimalValue
in class org.codehaus.jackson.JsonParser
IOException
org.codehaus.jackson.JsonParseException
public double getDoubleValue() throws IOException, org.codehaus.jackson.JsonParseException
getDoubleValue
in class org.codehaus.jackson.JsonParser
IOException
org.codehaus.jackson.JsonParseException
public float getFloatValue() throws IOException, org.codehaus.jackson.JsonParseException
getFloatValue
in class org.codehaus.jackson.JsonParser
IOException
org.codehaus.jackson.JsonParseException
public int getIntValue() throws IOException, org.codehaus.jackson.JsonParseException
getIntValue
in class org.codehaus.jackson.JsonParser
IOException
org.codehaus.jackson.JsonParseException
public long getLongValue() throws IOException, org.codehaus.jackson.JsonParseException
getLongValue
in class org.codehaus.jackson.JsonParser
IOException
org.codehaus.jackson.JsonParseException
public org.codehaus.jackson.JsonParser.NumberType getNumberType() throws IOException, org.codehaus.jackson.JsonParseException
getNumberType
in class org.codehaus.jackson.JsonParser
IOException
org.codehaus.jackson.JsonParseException
public Number getNumberValue() throws IOException, org.codehaus.jackson.JsonParseException
getNumberValue
in class org.codehaus.jackson.JsonParser
IOException
org.codehaus.jackson.JsonParseException
protected void _handleEOF() throws org.codehaus.jackson.JsonParseException
_handleEOF
in class org.codehaus.jackson.impl.JsonParserMinimalBase
org.codehaus.jackson.JsonParseException
protected void _releaseBuffers() throws IOException
IOException
protected org.codehaus.jackson.util.ByteArrayBuilder _getByteArrayBuilder()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |