Top Description Fields Constructors Methods
com.fasterxml.aalto.in

public abstract Class InputBootstrapper

extends Object
implements XmlConsts
Class Inheritance
All Implemented Interfaces
com.fasterxml.aalto.util.XmlConsts
Known Direct Subclasses
com.fasterxml.aalto.in.ByteSourceBootstrapper, com.fasterxml.aalto.in.CharSourceBootstrapper
Imports
java.io.*, javax.xml.stream.Location, .XMLStreamException, com.fasterxml.aalto.WFCException, com.fasterxml.aalto.util.XmlConsts

Abstract base class that defines shared functionality between different bootstrappers (byte stream, char Readers, block input)

Field Summary

Modifier and TypeField and Description
pack-priv final ReaderConfig
protected int
_inputProcessed

Current number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.

protected int
_inputRow

Current row location of current point in input buffer, using zero-based counting.

protected int
_inputRowStart

Current index of the first character of the current row in input buffer.

public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
pack-priv int
mDeclaredXmlVersion

XML declaration from the input (1.0, 1.1 or 'unknown')

pack-priv String
mFoundEncoding

Value of encoding pseudo-attribute from xml declaration, if one was found; null otherwise.

pack-priv final char[]
mKeyword

Need a short buffer to read in values of pseudo-attributes (version, encoding, standalone).

pack-priv String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public abstract XmlScanner
bootstrap()

Main bootstrapping method, which will try to open the underlying input source, check its encoding, read xml declaration if there is one, and finally create a scanner for actual parsing.

protected abstract int

Returns:

First character that does not match expected, if any; CHAR_NULL if match succeeded
checkKeyword
(String exp)

protected abstract Location
protected abstract int
protected abstract int
getNextAfterWs(boolean reqWs)

private final int
getWsOrChar(int ok)

Method that should get next character, which has to be either specified character (usually end marker), OR, any character as long as there' at least one space character before it.

private final int
protected abstract void
protected abstract int
readQuotedValue(char[] kw, int quoteChar)

protected void
readXmlDeclaration()

Method that will parse xml declaration, which at this point is known to exist.

private final String
private final String
private final int

Returns:

Xml version declaration read
readXmlVersion
()

protected void
protected void
protected final void
reportPseudoAttrProblem(String attrName, String got, String expVal1, String expVal2)

protected void
protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_configback to summary
pack-priv final ReaderConfig _config
_inputProcessedback to summary
protected int _inputProcessed

Current number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.

Note

includes possible BOMs, if those were part of the input.

_inputRowback to summary
protected int _inputRow

Current row location of current point in input buffer, using zero-based counting.

_inputRowStartback to summary
protected int _inputRowStart

Current index of the first character of the current row in input buffer. Needed to calculate column position, if necessary; benefit of not having column itself is that this only has to be updated once per line.

ERR_XMLDECL_END_MARKERback to summary
public static final String ERR_XMLDECL_END_MARKER
ERR_XMLDECL_EXP_ATTRVALback to summary
public static final String ERR_XMLDECL_EXP_ATTRVAL
ERR_XMLDECL_EXP_EQback to summary
public static final String ERR_XMLDECL_EXP_EQ
ERR_XMLDECL_EXP_SPACEback to summary
public static final String ERR_XMLDECL_EXP_SPACE
ERR_XMLDECL_KW_ENCODINGback to summary
public static final String ERR_XMLDECL_KW_ENCODING
ERR_XMLDECL_KW_STANDALONEback to summary
public static final String ERR_XMLDECL_KW_STANDALONE
ERR_XMLDECL_KW_VERSIONback to summary
public static final String ERR_XMLDECL_KW_VERSION
mDeclaredXmlVersionback to summary
pack-priv int mDeclaredXmlVersion

XML declaration from the input (1.0, 1.1 or 'unknown')

mFoundEncodingback to summary
pack-priv String mFoundEncoding

Value of encoding pseudo-attribute from xml declaration, if one was found; null otherwise.

mKeywordback to summary
pack-priv final char[] mKeyword

Need a short buffer to read in values of pseudo-attributes (version, encoding, standalone). Don't really need tons of space; just enough for the longest anticipated encoding id... and maybe few chars just in case (for additional white space that we ignore)

mStandaloneback to summary
pack-priv String mStandalone

Constructor Detail

InputBootstrapperback to summary
protected InputBootstrapper(ReaderConfig cfg)

Method Detail

bootstrapback to summary
public abstract XmlScanner bootstrap() throws XMLStreamException

Main bootstrapping method, which will try to open the underlying input source, check its encoding, read xml declaration if there is one, and finally create a scanner for actual parsing.

checkKeywordback to summary
protected abstract int checkKeyword(String exp) throws IOException, XMLStreamException
Returns:int

First character that does not match expected, if any; CHAR_NULL if match succeeded

getLocationback to summary
protected abstract Location getLocation()
getNextback to summary
protected abstract int getNext() throws IOException, XMLStreamException
getNextAfterWsback to summary
protected abstract int getNextAfterWs(boolean reqWs) throws IOException, XMLStreamException
getWsOrCharback to summary
private final int getWsOrChar(int ok) throws IOException, XMLStreamException

Method that should get next character, which has to be either specified character (usually end marker), OR, any character as long as there' at least one space character before it.

handleEqback to summary
private final int handleEq(String attr) throws IOException, XMLStreamException
pushbackback to summary
protected abstract void pushback()
readQuotedValueback to summary
protected abstract int readQuotedValue(char[] kw, int quoteChar) throws IOException, XMLStreamException
readXmlDeclarationback to summary
protected void readXmlDeclaration() throws IOException, XMLStreamException

Method that will parse xml declaration, which at this point is known to exist.

readXmlEncodingback to summary
private final String readXmlEncoding() throws IOException, XMLStreamException
readXmlStandaloneback to summary
private final String readXmlStandalone() throws IOException, XMLStreamException
readXmlVersionback to summary
private final int readXmlVersion() throws IOException, XMLStreamException
Returns:int

Xml version declaration read

reportEofback to summary
protected void reportEof() throws XMLStreamException
reportNullback to summary
protected void reportNull() throws XMLStreamException
reportPseudoAttrProblemback to summary
protected final void reportPseudoAttrProblem(String attrName, String got, String expVal1, String expVal2) throws XMLStreamException
reportUnexpectedCharback to summary
protected void reportUnexpectedChar(int i, String msg) throws XMLStreamException
reportXmlProblemback to summary
protected void reportXmlProblem(String msg) throws XMLStreamException