Package com.fasterxml.aalto.in
Class ByteSourceBootstrapper
- java.lang.Object
-
- com.fasterxml.aalto.in.InputBootstrapper
-
- com.fasterxml.aalto.in.ByteSourceBootstrapper
-
- All Implemented Interfaces:
XmlConsts
public final class ByteSourceBootstrapper extends InputBootstrapper
Class that takes care of bootstrapping main document input from a byte-oriented input source: usually either anInputStream, or a block source like byte array.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.InputStream_inUnderlying InputStream to use for reading content.protected byte[]_inputBufferprotected booleanmBigEndianprotected booleanmByteSizeFoundprotected intmBytesPerCharprotected booleanmHadBOM-
Fields inherited from class com.fasterxml.aalto.in.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_VERSION
-
Fields inherited from interface com.fasterxml.aalto.util.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description XmlScannerbootstrap()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 intcheckKeyword(java.lang.String exp)protected intcheckMbKeyword(java.lang.String expected)protected intcheckSbKeyword(java.lang.String expected)static ByteSourceBootstrapperconstruct(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen)static ByteSourceBootstrapperconstruct(ReaderConfig cfg, java.io.InputStream in)XmlScannerdoBootstrap()protected booleanensureLoaded(int minimum)protected javax.xml.stream.LocationgetLocation()protected intgetNext()protected intgetNextAfterWs(boolean reqWs)protected booleanhasXmlDeclaration()protected voidloadMore()protected bytenextByte()protected intnextMultiByte()protected voidpushback()protected intreadQuotedValue(char[] kw, int quoteChar)protected voidskipMbLF(int lf)protected intskipMbWs()protected voidskipSbLF(byte lfByte)protected intskipSbWs()protected java.lang.StringverifyXmlEncoding(java.lang.String enc)-
Methods inherited from class com.fasterxml.aalto.in.InputBootstrapper
readXmlDeclaration, reportEof, reportNull, reportPseudoAttrProblem, reportUnexpectedChar, reportXmlProblem
-
-
-
-
Field Detail
-
_in
protected final java.io.InputStream _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 Detail
-
construct
public static ByteSourceBootstrapper construct(ReaderConfig cfg, java.io.InputStream in) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
construct
public static ByteSourceBootstrapper construct(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
bootstrap
public final XmlScanner bootstrap() throws javax.xml.stream.XMLStreamException
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:
javax.xml.stream.XMLStreamException
-
doBootstrap
public XmlScanner doBootstrap() throws java.io.IOException, javax.xml.stream.XMLStreamException
- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
hasXmlDeclaration
protected boolean hasXmlDeclaration() throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
verifyXmlEncoding
protected java.lang.String verifyXmlEncoding(java.lang.String enc) throws javax.xml.stream.XMLStreamException- Returns:
- Normalized encoding name
- Throws:
javax.xml.stream.XMLStreamException
-
ensureLoaded
protected boolean ensureLoaded(int minimum) throws java.io.IOException- Throws:
java.io.IOException
-
loadMore
protected void loadMore() throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
pushback
protected void pushback()
- Specified by:
pushbackin classInputBootstrapper
-
getNext
protected int getNext() throws java.io.IOException, javax.xml.stream.XMLStreamException- Specified by:
getNextin classInputBootstrapper- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
getNextAfterWs
protected int getNextAfterWs(boolean reqWs) throws java.io.IOException, javax.xml.stream.XMLStreamException- Specified by:
getNextAfterWsin classInputBootstrapper- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
checkKeyword
protected int checkKeyword(java.lang.String exp) throws java.io.IOException, javax.xml.stream.XMLStreamException- Specified by:
checkKeywordin classInputBootstrapper- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
readQuotedValue
protected int readQuotedValue(char[] kw, int quoteChar) throws java.io.IOException, javax.xml.stream.XMLStreamException- Specified by:
readQuotedValuein classInputBootstrapper- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
getLocation
protected javax.xml.stream.Location getLocation()
- Specified by:
getLocationin classInputBootstrapper
-
nextByte
protected byte nextByte() throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
skipSbWs
protected int skipSbWs() throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
skipSbLF
protected void skipSbLF(byte lfByte) throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
checkSbKeyword
protected int checkSbKeyword(java.lang.String expected) throws java.io.IOException, javax.xml.stream.XMLStreamException- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
nextMultiByte
protected int nextMultiByte() throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
skipMbWs
protected int skipMbWs() throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
skipMbLF
protected void skipMbLF(int lf) throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
checkMbKeyword
protected int checkMbKeyword(java.lang.String expected) throws java.io.IOException, javax.xml.stream.XMLStreamException- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
-