Top Description Fields Constructors Methods
com.fasterxml.aalto.in

public final Class ByteSourceBootstrapper

extends InputBootstrapper
Class Inheritance
Imports
java.io.*, javax.xml.stream.Location, .XMLStreamException, com.fasterxml.aalto.impl.IoStreamException, .LocationImpl, com.fasterxml.aalto.util.CharsetNames

Class that takes care of bootstrapping main document input from a byte-oriented input source: usually either an InputStream, or a block source like byte array.

Field Summary

Modifier and TypeField and Description
protected final InputStream
_in

Underlying InputStream to use for reading content.

protected final byte[]
private int
private int
private static final byte
private static final byte
private static final byte
protected boolean
protected boolean
protected int
protected boolean
Inherited from com.fasterxml.aalto.in.InputBootstrapper:
_config_inputProcessed_inputRow_inputRowStartERR_XMLDECL_END_MARKERERR_XMLDECL_EXP_ATTRVALERR_XMLDECL_EXP_EQERR_XMLDECL_EXP_SPACEERR_XMLDECL_KW_ENCODINGERR_XMLDECL_KW_STANDALONEERR_XMLDECL_KW_VERSIONmDeclaredXmlVersionmFoundEncodingmKeywordmStandalone

Constructor Summary

AccessConstructor and Description
private
private
ByteSourceBootstrapper(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen)

Method Summary

Modifier and TypeMethod and Description
public final XmlScanner
bootstrap()

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.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

Returns:

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

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.checkKeyword.

protected int

Returns:

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

protected int

Returns:

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

public static ByteSourceBootstrapper
public static ByteSourceBootstrapper
construct(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen)

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)

public XmlScanner
protected boolean
ensureLoaded(int minimum)

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

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.readQuotedValue.

private void
private void
protected void
skipMbLF(int lf)

protected int
protected void
skipSbLF(byte lfByte)

protected int
private void
verifyEncoding(String id, int bpc)

private void
verifyEncoding(String id, int bpc, boolean bigEndian)

protected String

Returns:

Normalized encoding name
verifyXmlEncoding
(String enc)

Inherited from com.fasterxml.aalto.in.InputBootstrapper:
readXmlDeclarationreportEofreportNullreportPseudoAttrProblemreportUnexpectedCharreportXmlProblem

Field Detail

_inback to summary
protected final InputStream _in

Underlying InputStream to use for reading content.

_inputBufferback to summary
protected final byte[] _inputBuffer
_inputLenback to summary
private int _inputLen
_inputPtrback to summary
private int _inputPtr
BYTE_CRback to summary
private static final byte BYTE_CR
BYTE_LFback to summary
private static final byte BYTE_LF
BYTE_NULLback to summary
private static final byte BYTE_NULL
mBigEndianback to summary
protected boolean mBigEndian
mByteSizeFoundback to summary
protected boolean mByteSizeFound
mBytesPerCharback to summary
protected int mBytesPerChar
mHadBOMback to summary
protected boolean mHadBOM

Constructor Detail

ByteSourceBootstrapperback to summary
private ByteSourceBootstrapper(ReaderConfig cfg, InputStream in)
ByteSourceBootstrapperback to summary
private ByteSourceBootstrapper(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen)

Method Detail

bootstrapback to summary
public final XmlScanner bootstrap() throws XMLStreamException

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.bootstrap.

Doc from com.fasterxml.aalto.in.InputBootstrapper.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.

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

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.checkKeyword.

Returns:int

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

Annotations
@Override
checkMbKeywordback to summary
protected int checkMbKeyword(String expected) throws IOException, XMLStreamException
Returns:int

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

checkSbKeywordback to summary
protected int checkSbKeyword(String expected) throws IOException, XMLStreamException
Returns:int

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

constructback to summary
public static ByteSourceBootstrapper construct(ReaderConfig cfg, InputStream in) throws XMLStreamException
constructback to summary
public static ByteSourceBootstrapper construct(ReaderConfig cfg, byte[] inputBuffer, int inputStart, int inputLen) throws XMLStreamException
determineStreamEncodingback to summary
private void determineStreamEncoding() throws IOException

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)

doBootstrapback to summary
public XmlScanner doBootstrap() throws IOException, XMLStreamException
ensureLoadedback to summary
protected boolean ensureLoaded(int minimum) throws IOException
getLocationback to summary
protected Location getLocation()

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.getLocation.

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

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.getNext.

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

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.getNextAfterWs.

Annotations
@Override
hasXmlDeclarationback to summary
protected boolean hasXmlDeclaration() throws IOException, XMLStreamException
loadMoreback to summary
protected void loadMore() throws IOException, XMLStreamException
nextByteback to summary
protected byte nextByte() throws IOException, XMLStreamException
nextMultiByteback to summary
protected int nextMultiByte() throws IOException, XMLStreamException
pushbackback to summary
protected void pushback()

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.pushback.

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

Implements abstract com.fasterxml.aalto.in.InputBootstrapper.readQuotedValue.

Annotations
@Override
reportEBCDICback to summary
private void reportEBCDIC() throws IOException
reportWeirdUCS4back to summary
private void reportWeirdUCS4(String type) throws IOException
skipMbLFback to summary
protected void skipMbLF(int lf) throws IOException, XMLStreamException
skipMbWsback to summary
protected int skipMbWs() throws IOException, XMLStreamException
skipSbLFback to summary
protected void skipSbLF(byte lfByte) throws IOException, XMLStreamException
skipSbWsback to summary
protected int skipSbWs() throws IOException, XMLStreamException
verifyEncodingback to summary
private void verifyEncoding(String id, int bpc) throws XMLStreamException
verifyEncodingback to summary
private void verifyEncoding(String id, int bpc, boolean bigEndian) throws XMLStreamException
verifyXmlEncodingback to summary
protected String verifyXmlEncoding(String enc) throws XMLStreamException
Returns:String

Normalized encoding name