Top Description Fields Constructors Methods
com.ctc.wstx.io

public final Class ReaderBootstrapper

extends InputBootstrapper
Class Inheritance
Imports
java.io.*, java.text.MessageFormat, javax.xml.stream.Location, .XMLReporter, .XMLStreamException, org.codehaus.stax2.validation.XMLValidationProblem, com.ctc.wstx.api.ReaderConfig, com.ctc.wstx.cfg.ErrorConsts, .ParsingErrorMsgs, com.ctc.wstx.exc.*, com.ctc.wstx.util.StringUtil

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

Modifier and TypeField and Description
pack-priv static final char
private char[]
pack-priv final Reader
mIn

Underlying Reader to use for reading content.

pack-priv final String
mInputEncoding

Encoding identifier processing application passed in; if not null, will be compared to actual xml declaration based encoding (if declaration found)

private int
private int
Inherited from com.ctc.wstx.io.InputBootstrapper:
BYTE_CRBYTE_LFBYTE_NULLCHAR_CRCHAR_LFCHAR_NELCHAR_NULLCHAR_SPACEERR_XMLDECL_END_MARKERERR_XMLDECL_EXP_ATTRVALERR_XMLDECL_EXP_EQERR_XMLDECL_EXP_SPACEERR_XMLDECL_KW_ENCODINGERR_XMLDECL_KW_STANDALONEERR_XMLDECL_KW_VERSIONmDeclaredXmlVersionmFoundEncodingmInputProcessedmInputRowmInputRowStartmKeywordBuffermPublicIdmStandalonemSystemIdmXml11Handling

Constructor Summary

AccessConstructor and Description
private
ReaderBootstrapper(String pubId, SystemId sysId, Reader r, String appEncoding)

Method Summary

Modifier and TypeMethod and Description
public Reader

Returns:

Actual reader to use for reading xml content
bootstrapInput
(ReaderConfig cfg, boolean mainDoc, int
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.
xmlVersion
)

Implements abstract com.ctc.wstx.io.InputBootstrapper.bootstrapInput.

Method called to do actual bootstrapping.

protected int

Returns:

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

Implements abstract com.ctc.wstx.io.InputBootstrapper.checkKeyword.

public int
public String
getInputEncoding()

Implements abstract com.ctc.wstx.io.InputBootstrapper.getInputEncoding.

Actual 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).

public int
public static ReaderBootstrapper
getInstance(String pubId, SystemId sysId, Reader
Eventual reader that will be reading actual content, after bootstrapping finishes
r
,
String
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.
appEncoding
)

protected Location
protected int
protected int
protected boolean
initialLoad(int minimum)

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

Implements abstract com.ctc.wstx.io.InputBootstrapper.readQuotedValue.

protected void
skipCRLF(char lf)

protected void
Inherited from com.ctc.wstx.io.InputBootstrapper:
declaredXml11getDeclaredEncodinggetDeclaredVersiongetInputRowgetPublicIdgetStandalonegetSystemIdinitFromreadXmlDeclreportNullreportUnexpectedCharreportXmlProblem

Field Detail

CHAR_BOM_MARKERback to summary
pack-priv static final char CHAR_BOM_MARKER
mCharBufferback to summary
private char[] mCharBuffer
mInback to summary
pack-priv final Reader mIn

Underlying Reader to use for reading content.

mInputEncodingback to summary
pack-priv final String mInputEncoding

Encoding identifier processing application passed in; if not null, will be compared to actual xml declaration based encoding (if declaration found)

mInputEndback to summary
private int mInputEnd
mInputPtrback to summary
private int mInputPtr

Constructor Detail

ReaderBootstrapperback to summary
private ReaderBootstrapper(String pubId, SystemId sysId, Reader r, String appEncoding)

Method Detail

bootstrapInputback to summary
public Reader bootstrapInput(ReaderConfig cfg, boolean mainDoc, int xmlVersion) throws IOException, XMLStreamException

Implements abstract com.ctc.wstx.io.InputBootstrapper.bootstrapInput.

Method called to do actual bootstrapping.

Parameters
xmlVersion:int

Doc from com.ctc.wstx.io.InputBootstrapper.bootstrapInput.

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:Reader

Actual reader to use for reading xml content

Annotations
@Override
checkKeywordback to summary
protected int checkKeyword(String exp) throws IOException, WstxException

Implements abstract com.ctc.wstx.io.InputBootstrapper.checkKeyword.

Returns:int

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

Annotations
@Override
getInputColumnback to summary
public int getInputColumn()

Implements abstract com.ctc.wstx.io.InputBootstrapper.getInputColumn.

Annotations
@Override
getInputEncodingback to summary
public String getInputEncoding()

Implements abstract com.ctc.wstx.io.InputBootstrapper.getInputEncoding.

Doc from com.ctc.wstx.io.InputBootstrapper.getInputEncoding.

Actual 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).

Returns:String

Input encoding in use, if it could be determined or was passed by the calling application

Annotations
@Override
getInputTotalback to summary
public int getInputTotal()

Implements abstract com.ctc.wstx.io.InputBootstrapper.getInputTotal.

Returns:int

Doc from com.ctc.wstx.io.InputBootstrapper.getInputTotal.

Total number of characters read from bootstrapped input (stream, reader)

Annotations
@Override
getInstanceback to summary
public static ReaderBootstrapper getInstance(String pubId, SystemId sysId, Reader r, String appEncoding)
Parameters
r:Reader

Eventual reader that will be reading actual content, after bootstrapping finishes

appEncoding:String

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.

getLocationback to summary
protected Location getLocation()

Implements abstract com.ctc.wstx.io.InputBootstrapper.getLocation.

Annotations
@Override
getNextback to summary
protected int getNext() throws IOException, WstxException

Implements abstract com.ctc.wstx.io.InputBootstrapper.getNext.

Annotations
@Override
getNextAfterWsback to summary
protected int getNextAfterWs(boolean reqWs) throws IOException, WstxException

Implements abstract com.ctc.wstx.io.InputBootstrapper.getNextAfterWs.

Annotations
@Override
initialLoadback to summary
protected boolean initialLoad(int minimum) throws IOException
loadMoreback to summary
protected void loadMore() throws IOException, WstxException
nextCharback to summary
protected char nextChar() throws IOException, WstxException
pushbackback to summary
protected void pushback()

Implements abstract com.ctc.wstx.io.InputBootstrapper.pushback.

Annotations
@Override
readQuotedValueback to summary
protected int readQuotedValue(char[] kw, int quoteChar) throws IOException, WstxException

Implements abstract com.ctc.wstx.io.InputBootstrapper.readQuotedValue.

Annotations
@Override
skipCRLFback to summary
protected void skipCRLF(char lf) throws IOException, WstxException
verifyXmlEncodingback to summary
protected void verifyXmlEncoding(ReaderConfig cfg) throws XMLStreamException