public final class ByteSourceBootstrapper extends InputBootstrapper
InputStream
,
or a block source like byte array.Modifier and Type | Field and Description |
---|---|
(package private) java.io.InputStream |
_in
Underlying InputStream to use for reading content.
|
(package private) byte[] |
_inputBuffer |
private int |
_inputLen |
private int |
_inputPtr |
private static byte |
BYTE_CR |
private static byte |
BYTE_LF |
private static byte |
BYTE_NULL |
(package private) boolean |
mBigEndian |
(package private) boolean |
mByteSizeFound |
(package private) int |
mBytesPerChar |
(package private) boolean |
mHadBOM |
_config, _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, mDeclaredXmlVersion, mFoundEncoding, mKeyword, mStandalone
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
Modifier | Constructor and Description |
---|---|
private |
ByteSourceBootstrapper(ReaderConfig cfg,
byte[] inputBuffer,
int inputStart,
int inputLen) |
private |
ByteSourceBootstrapper(ReaderConfig cfg,
java.io.InputStream in) |
Modifier and Type | Method and Description |
---|---|
XmlScanner |
bootstrap()
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 int |
checkKeyword(java.lang.String exp) |
protected int |
checkMbKeyword(java.lang.String expected) |
protected int |
checkSbKeyword(java.lang.String expected) |
static ByteSourceBootstrapper |
construct(ReaderConfig cfg,
byte[] inputBuffer,
int inputStart,
int inputLen) |
static ByteSourceBootstrapper |
construct(ReaderConfig cfg,
java.io.InputStream in) |
private void |
determineStreamEncoding()
Method called to figure out what the physical encoding of the
file appears to be (in case it can be determined from BOM, or
xml declaration, either of which may be present)
|
XmlScanner |
doBootstrap() |
protected boolean |
ensureLoaded(int minimum) |
protected javax.xml.stream.Location |
getLocation() |
protected int |
getNext() |
protected int |
getNextAfterWs(boolean reqWs) |
protected boolean |
hasXmlDeclaration() |
protected void |
loadMore() |
protected byte |
nextByte() |
protected int |
nextMultiByte() |
protected void |
pushback() |
protected int |
readQuotedValue(char[] kw,
int quoteChar) |
private void |
reportEBCDIC() |
private void |
reportWeirdUCS4(java.lang.String type) |
protected void |
skipMbLF(int lf) |
protected int |
skipMbWs() |
protected void |
skipSbLF(byte lfByte) |
protected int |
skipSbWs() |
private void |
verifyEncoding(java.lang.String id,
int bpc) |
private void |
verifyEncoding(java.lang.String id,
int bpc,
boolean bigEndian) |
protected java.lang.String |
verifyXmlEncoding(java.lang.String enc) |
readXmlDeclaration, reportEof, reportNull, reportPseudoAttrProblem, reportUnexpectedChar, reportXmlProblem
private static final byte BYTE_NULL
private static final byte BYTE_CR
private static final byte BYTE_LF
final java.io.InputStream _in
final byte[] _inputBuffer
private int _inputPtr
private int _inputLen
boolean mBigEndian
int mBytesPerChar
boolean mHadBOM
boolean mByteSizeFound
private ByteSourceBootstrapper(ReaderConfig cfg, java.io.InputStream in)
private ByteSourceBootstrapper(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen)
public static ByteSourceBootstrapper construct(ReaderConfig cfg, java.io.InputStream in) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static ByteSourceBootstrapper construct(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final XmlScanner bootstrap() throws javax.xml.stream.XMLStreamException
InputBootstrapper
bootstrap
in class InputBootstrapper
javax.xml.stream.XMLStreamException
public XmlScanner doBootstrap() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private void determineStreamEncoding() throws java.io.IOException
java.io.IOException
protected boolean hasXmlDeclaration() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected java.lang.String verifyXmlEncoding(java.lang.String enc) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected boolean ensureLoaded(int minimum) throws java.io.IOException
java.io.IOException
protected void loadMore() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected void pushback()
pushback
in class InputBootstrapper
protected int getNext() throws java.io.IOException, javax.xml.stream.XMLStreamException
getNext
in class InputBootstrapper
java.io.IOException
javax.xml.stream.XMLStreamException
protected int getNextAfterWs(boolean reqWs) throws java.io.IOException, javax.xml.stream.XMLStreamException
getNextAfterWs
in class InputBootstrapper
java.io.IOException
javax.xml.stream.XMLStreamException
protected int checkKeyword(java.lang.String exp) throws java.io.IOException, javax.xml.stream.XMLStreamException
checkKeyword
in class InputBootstrapper
java.io.IOException
javax.xml.stream.XMLStreamException
protected int readQuotedValue(char[] kw, int quoteChar) throws java.io.IOException, javax.xml.stream.XMLStreamException
readQuotedValue
in class InputBootstrapper
java.io.IOException
javax.xml.stream.XMLStreamException
protected javax.xml.stream.Location getLocation()
getLocation
in class InputBootstrapper
protected byte nextByte() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected int skipSbWs() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected void skipSbLF(byte lfByte) throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected int checkSbKeyword(java.lang.String expected) throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected int nextMultiByte() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected int skipMbWs() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected void skipMbLF(int lf) throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected int checkMbKeyword(java.lang.String expected) throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private void verifyEncoding(java.lang.String id, int bpc) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void verifyEncoding(java.lang.String id, int bpc, boolean bigEndian) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void reportWeirdUCS4(java.lang.String type) throws java.io.IOException
java.io.IOException
private void reportEBCDIC() throws java.io.IOException
java.io.IOException