Package com.ctc.wstx.io
Class BambooStreamBootstrapper
java.lang.Object
com.ctc.wstx.io.InputBootstrapper
com.ctc.wstx.io.BambooStreamBootstrapper
public final class BambooStreamBootstrapper
extends com.ctc.wstx.io.InputBootstrapper
Input bootstrap class used with streams, when encoding is not known (when encoding is specified by application, a
reader is constructed, and then reader-based bootstrapper is used). Encoding used for an entity (including main
document entity) is determined using algorithms suggested in XML 1.0#3 spec, appendix F
-
Field Summary
Fields inherited from class com.ctc.wstx.io.InputBootstrapper
BYTE_CR, BYTE_LF, BYTE_NULL, CHAR_CR, CHAR_LF, CHAR_NEL, CHAR_NULL, CHAR_SPACE, 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, mDeclaredXmlVersion, mFoundEncoding, mInputProcessed, mInputRow, mInputRowStart, mKeywordBuffer, mPublicId, mStandalone, mSystemId, mXml11Handling
-
Method Summary
Modifier and TypeMethodDescriptionbootstrapInput
(com.ctc.wstx.api.ReaderConfig cfg, boolean mainDoc, int xmlVersion) protected int
checkKeyword
(String exp) protected int
checkMbKeyword
(String expected) protected int
checkSbKeyword
(String expected) protected int
checkTranslatedKeyword
(String expected) protected boolean
ensureLoaded
(int minimum) int
Since this class only gets used when encoding is not explicitly passed, need use the encoding that was auto-detected...int
static BambooStreamBootstrapper
getInstance
(String pubId, com.ctc.wstx.io.SystemId sysId, byte[] data, int start, int end) Factory method used when the underlying data provider is a pre-allocated block source, and no stream is used.static BambooStreamBootstrapper
getInstance
(String pubId, com.ctc.wstx.io.SystemId sysId, InputStream in) Factory method used when the underlying data provider is an actual stream.protected Location
protected int
getNext()
protected int
getNextAfterWs
(boolean reqWs) protected boolean
protected void
loadMore()
protected byte
nextByte()
protected int
protected int
protected void
pushback()
protected int
readQuotedValue
(char[] kw, int quoteChar) protected void
Method called to try to figure out physical encoding the underlying input stream uses.protected void
skipMbLF
(int lf) protected int
skipMbWs()
protected void
skipSbLF
(byte lfByte) protected int
skipSbWs()
protected void
skipTranslatedLF
(int lf) protected int
protected String
verifyXmlEncoding
(String enc) Methods inherited from class com.ctc.wstx.io.InputBootstrapper
declaredXml11, getDeclaredEncoding, getDeclaredVersion, getInputRow, getPublicId, getStandalone, getSystemId, initFrom, readXmlDecl, reportNull, reportUnexpectedChar, reportXmlProblem
-
Method Details
-
getInstance
public static BambooStreamBootstrapper getInstance(String pubId, com.ctc.wstx.io.SystemId sysId, InputStream in) Factory method used when the underlying data provider is an actual stream. -
getInstance
public static BambooStreamBootstrapper getInstance(String pubId, com.ctc.wstx.io.SystemId sysId, byte[] data, int start, int end) Factory method used when the underlying data provider is a pre-allocated block source, and no stream is used. Additionally the buffer passed is not owned by the bootstrapper or Reader that is created, so it is not to be recycled. -
bootstrapInput
public Reader bootstrapInput(com.ctc.wstx.api.ReaderConfig cfg, boolean mainDoc, int xmlVersion) throws IOException, XMLStreamException - Specified by:
bootstrapInput
in classcom.ctc.wstx.io.InputBootstrapper
- Throws:
IOException
XMLStreamException
-
getInputEncoding
Since this class only gets used when encoding is not explicitly passed, need use the encoding that was auto-detected...- Specified by:
getInputEncoding
in classcom.ctc.wstx.io.InputBootstrapper
-
getInputTotal
public int getInputTotal()- Specified by:
getInputTotal
in classcom.ctc.wstx.io.InputBootstrapper
-
getInputColumn
public int getInputColumn()- Specified by:
getInputColumn
in classcom.ctc.wstx.io.InputBootstrapper
-
resolveStreamEncoding
Method called to try to figure out physical encoding the underlying input stream uses.- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
verifyXmlEncoding
- Returns:
- Normalized encoding name
- Throws:
com.ctc.wstx.exc.WstxException
-
ensureLoaded
- Throws:
IOException
-
loadMore
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
pushback
protected void pushback()- Specified by:
pushback
in classcom.ctc.wstx.io.InputBootstrapper
-
getNext
- Specified by:
getNext
in classcom.ctc.wstx.io.InputBootstrapper
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
getNextAfterWs
- Specified by:
getNextAfterWs
in classcom.ctc.wstx.io.InputBootstrapper
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
checkKeyword
- Specified by:
checkKeyword
in classcom.ctc.wstx.io.InputBootstrapper
- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
readQuotedValue
protected int readQuotedValue(char[] kw, int quoteChar) throws IOException, com.ctc.wstx.exc.WstxException - Specified by:
readQuotedValue
in classcom.ctc.wstx.io.InputBootstrapper
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
hasXmlDecl
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
getLocation
- Specified by:
getLocation
in classcom.ctc.wstx.io.InputBootstrapper
-
nextByte
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
skipSbWs
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
skipSbLF
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
checkSbKeyword
- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
nextMultiByte
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
nextTranslated
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
skipMbWs
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
skipTranslatedWs
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
skipMbLF
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
skipTranslatedLF
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
checkMbKeyword
- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOException
com.ctc.wstx.exc.WstxException
-
checkTranslatedKeyword
protected int checkTranslatedKeyword(String expected) throws IOException, com.ctc.wstx.exc.WstxException - Throws:
IOException
com.ctc.wstx.exc.WstxException
-