Class ByteSourceBootstrapper
java.lang.Object
com.fasterxml.aalto.in.InputBootstrapper
com.fasterxml.aalto.in.ByteSourceBootstrapper
- All Implemented Interfaces:
XmlConsts
Class that takes care of bootstrapping main document input from
a byte-oriented input source: usually either an
InputStream,
or a block source like byte array.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final InputStreamUnderlying InputStream to use for reading content.protected final byte[]protected booleanprotected booleanprotected intprotected booleanFields inherited from class InputBootstrapper
_inputProcessed, _inputRow, _inputRowStart, ERR_XMLDECL_END_MARKER, ERR_XMLDECL_EXP_ATTRVAL, ERR_XMLDECL_EXP_EQ, ERR_XMLDECL_EXP_SPACE, ERR_XMLDECL_KW_ENCODING, ERR_XMLDECL_KW_STANDALONE, ERR_XMLDECL_KW_VERSIONFields inherited from interface XmlConsts
CHAR_CR, CHAR_LF, CHAR_NULL, CHAR_SPACE, MAX_UNICODE_CHAR, STAX_DEFAULT_OUTPUT_ENCODING, STAX_DEFAULT_OUTPUT_VERSION, XML_DECL_KW_ENCODING, XML_DECL_KW_STANDALONE, XML_DECL_KW_VERSION, XML_SA_NO, XML_SA_YES, XML_V_10, XML_V_10_STR, XML_V_11, XML_V_11_STR, XML_V_UNKNOWN -
Method Summary
Modifier and TypeMethodDescriptionfinal XmlScannerMain 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 intcheckKeyword(String exp) protected intcheckMbKeyword(String expected) protected intcheckSbKeyword(String expected) static ByteSourceBootstrapperconstruct(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen) static ByteSourceBootstrapperconstruct(ReaderConfig cfg, InputStream in) protected booleanensureLoaded(int minimum) protected Locationprotected intgetNext()protected intgetNextAfterWs(boolean reqWs) protected booleanprotected voidloadMore()protected bytenextByte()protected intprotected voidpushback()protected intreadQuotedValue(char[] kw, int quoteChar) protected voidskipMbLF(int lf) protected intskipMbWs()protected voidskipSbLF(byte lfByte) protected intskipSbWs()protected StringverifyXmlEncoding(String enc) Methods inherited from class InputBootstrapper
readXmlDeclaration, reportEof, reportNull, reportPseudoAttrProblem, reportUnexpectedChar, reportXmlProblem
-
Field Details
-
_in
Underlying InputStream to use for reading content. -
_inputBuffer
protected final byte[] _inputBuffer -
mBigEndian
protected boolean mBigEndian -
mBytesPerChar
protected int mBytesPerChar -
mHadBOM
protected boolean mHadBOM -
mByteSizeFound
protected boolean mByteSizeFound
-
-
Method Details
-
construct
public static ByteSourceBootstrapper construct(ReaderConfig cfg, InputStream in) throws XMLStreamException - Throws:
XMLStreamException
-
construct
public static ByteSourceBootstrapper construct(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen) throws XMLStreamException - Throws:
XMLStreamException
-
bootstrap
Description copied from class:InputBootstrapperMain 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.- Specified by:
bootstrapin classInputBootstrapper- Throws:
XMLStreamException
-
doBootstrap
- Throws:
IOExceptionXMLStreamException
-
hasXmlDeclaration
- Throws:
IOExceptionXMLStreamException
-
verifyXmlEncoding
- Returns:
- Normalized encoding name
- Throws:
XMLStreamException
-
ensureLoaded
- Throws:
IOException
-
loadMore
- Throws:
IOExceptionXMLStreamException
-
pushback
protected void pushback()- Specified by:
pushbackin classInputBootstrapper
-
getNext
- Specified by:
getNextin classInputBootstrapper- Throws:
IOExceptionXMLStreamException
-
getNextAfterWs
- Specified by:
getNextAfterWsin classInputBootstrapper- Throws:
IOExceptionXMLStreamException
-
checkKeyword
- Specified by:
checkKeywordin classInputBootstrapper- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOExceptionXMLStreamException
-
readQuotedValue
- Specified by:
readQuotedValuein classInputBootstrapper- Throws:
IOExceptionXMLStreamException
-
getLocation
- Specified by:
getLocationin classInputBootstrapper
-
nextByte
- Throws:
IOExceptionXMLStreamException
-
skipSbWs
- Throws:
IOExceptionXMLStreamException
-
skipSbLF
- Throws:
IOExceptionXMLStreamException
-
checkSbKeyword
- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOExceptionXMLStreamException
-
nextMultiByte
- Throws:
IOExceptionXMLStreamException
-
skipMbWs
- Throws:
IOExceptionXMLStreamException
-
skipMbLF
- Throws:
IOExceptionXMLStreamException
-
checkMbKeyword
- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOExceptionXMLStreamException
-