Package com.ctc.wstx.io
Class ReaderBootstrapper
java.lang.Object
com.ctc.wstx.io.InputBootstrapper
com.ctc.wstx.io.ReaderBootstrapper
Input bootstrap class used when input comes from a Reader; in this case,
encoding is already known, and thus encoding from XML declaration (if
any) is only double-checked, not really used.
Note: since the actual Reader to use after bootstrapping is pre-constructed, the local input buffer can (and should) be quite small.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final charprivate char[](package private) final ReaderUnderlying Reader to use for reading content.(package private) final StringEncoding identifier processing application passed in; if not null, will be compared to actual xml declaration based encoding (if declaration found)private intprivate intFields 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 -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateReaderBootstrapper(String pubId, SystemId sysId, Reader r, String appEncoding) -
Method Summary
Modifier and TypeMethodDescriptionbootstrapInput(ReaderConfig cfg, boolean mainDoc, int xmlVersion) Method called to do actual bootstrapping.protected intcheckKeyword(String exp) intActual character encoding used by the underlying input source; may have been passed by the application, or auto-detected by byte stream boot strapper (can not be determined from a Reader source).intstatic ReaderBootstrappergetInstance(String pubId, SystemId sysId, Reader r, String appEncoding) protected Locationprotected intgetNext()protected intgetNextAfterWs(boolean reqWs) protected booleaninitialLoad(int minimum) protected voidloadMore()protected charnextChar()protected voidpushback()protected intreadQuotedValue(char[] kw, int quoteChar) protected voidskipCRLF(char lf) protected voidMethods inherited from class com.ctc.wstx.io.InputBootstrapper
declaredXml11, getDeclaredEncoding, getDeclaredVersion, getInputRow, getPublicId, getStandalone, getSystemId, initFrom, readXmlDecl, reportNull, reportUnexpectedChar, reportXmlProblem
-
Field Details
-
CHAR_BOM_MARKER
static final char CHAR_BOM_MARKER- See Also:
-
mIn
Underlying Reader to use for reading content. -
mInputEncoding
Encoding identifier processing application passed in; if not null, will be compared to actual xml declaration based encoding (if declaration found) -
mCharBuffer
private char[] mCharBuffer -
mInputPtr
private int mInputPtr -
mInputEnd
private int mInputEnd
-
-
Constructor Details
-
ReaderBootstrapper
-
-
Method Details
-
getInstance
public static ReaderBootstrapper getInstance(String pubId, SystemId sysId, Reader r, String appEncoding) - Parameters:
r- Eventual reader that will be reading actual content, after bootstrapping finishesappEncoding- Encoding that application declared; may be null. If not null, will be compared to actual declaration found; and incompatibility reported as a potential (but not necessarily fatal) problem.
-
bootstrapInput
public Reader bootstrapInput(ReaderConfig cfg, boolean mainDoc, int xmlVersion) throws IOException, XMLStreamException Method called to do actual bootstrapping.- Specified by:
bootstrapInputin classInputBootstrapper- Parameters:
xmlVersion- Optional xml version identifier of the main parsed document (if not bootstrapping the main document). Currently only relevant for checking that XML 1.0 document does not include XML 1.1 external parsed entities. If null, no checks will be done; when bootstrapping parsing of the main document, null should be passed for this argument.- Returns:
- Actual reader to use for reading xml content
- Throws:
IOExceptionXMLStreamException
-
getInputEncoding
Description copied from class:InputBootstrapperActual character encoding used by the underlying input source; may have been passed by the application, or auto-detected by byte stream boot strapper (can not be determined from a Reader source).- Specified by:
getInputEncodingin classInputBootstrapper- Returns:
- Input encoding in use, if it could be determined or was passed by the calling application
-
getInputTotal
public int getInputTotal()- Specified by:
getInputTotalin classInputBootstrapper- Returns:
- Total number of characters read from bootstrapped input (stream, reader)
-
getInputColumn
public int getInputColumn()- Specified by:
getInputColumnin classInputBootstrapper
-
verifyXmlEncoding
- Throws:
XMLStreamException
-
initialLoad
- Throws:
IOException
-
loadMore
- Throws:
IOExceptionWstxException
-
pushback
protected void pushback()- Specified by:
pushbackin classInputBootstrapper
-
getNext
- Specified by:
getNextin classInputBootstrapper- Throws:
IOExceptionWstxException
-
getNextAfterWs
- Specified by:
getNextAfterWsin classInputBootstrapper- Throws:
IOExceptionWstxException
-
checkKeyword
- Specified by:
checkKeywordin classInputBootstrapper- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOExceptionWstxException
-
readQuotedValue
- Specified by:
readQuotedValuein classInputBootstrapper- Throws:
IOExceptionWstxException
-
getLocation
- Specified by:
getLocationin classInputBootstrapper
-
nextChar
- Throws:
IOExceptionWstxException
-
skipCRLF
- Throws:
IOExceptionWstxException
-