Class BaseInputSource
java.lang.Object
com.ctc.wstx.io.WstxInputSource
com.ctc.wstx.io.BaseInputSource
- Direct Known Subclasses:
CharArraySource, ReaderSource
Abstract base class that implements shared functionality that all current
WstxInputSource implementations Woodstox includes need.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected char[]Input buffer this input source uses, if any.protected intLength of the buffer, if buffer used(package private) WstxInputLocation(package private) final String(package private) longNumber of characters read from the current input source prior to the current buffer(package private) int(package private) int(package private) int(package private) SystemIdURL for/from systemId points to original source of input, if known; null if not known (source constructed with just a stream or reader).Fields inherited from class WstxInputSource
mEntityDepth, mFromEntity, mParent, mScopeId -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseInputSource(WstxInputSource parent, String fromEntity, String publicId, SystemId systemId) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()Method reader calls for this input source when it has encountered EOF.protected abstract voiddoInitInputLocation(WstxInputData reader) abstract booleanprotected final WstxInputLocationThis method only gets called by the 'child' input source (for example, contents of an expanded entity), to get the enclosing context location.final WstxInputLocationgetLocation(long total, int row, int col) voidoverrideSource(URL src) Method that can be called to override originally defined source.abstract intreadInto(WstxInputData reader) Method called to read at least one more char from input source, and update input data appropriately.abstract booleanreadMore(WstxInputData reader, int minAmount) Method called by reader when it has to have at least specified number of consequtive input characters in its buffer, and it currently does not have.voidrestoreContext(WstxInputData reader) Method Reader calls when this input source is resumed as the current source.voidsaveContext(WstxInputData reader) Method Reader calls when this input source is being stored, when a nested input source gets used instead (due to entity expansion).Methods inherited from class WstxInputSource
closeCompletely, getEntityDepth, getEntityId, getParent, getScopeId, initInputLocation, isOrIsExpandedFrom, toString
-
Field Details
-
mPublicId
-
mSystemId
SystemId mSystemIdURL for/from systemId points to original source of input, if known; null if not known (source constructed with just a stream or reader). Used for resolving references from the input that's read from this source. Can be overridden by reader; done if P_BASE_URL is changed on stream reader for which this input source is the currently active input source. -
mBuffer
protected char[] mBufferInput buffer this input source uses, if any. -
mInputLast
protected int mInputLastLength of the buffer, if buffer used -
mSavedInputProcessed
long mSavedInputProcessedNumber of characters read from the current input source prior to the current buffer -
mSavedInputRow
int mSavedInputRow -
mSavedInputRowStart
int mSavedInputRowStart -
mSavedInputPtr
int mSavedInputPtr -
mParentLocation
-
-
Constructor Details
-
BaseInputSource
protected BaseInputSource(WstxInputSource parent, String fromEntity, String publicId, SystemId systemId)
-
-
Method Details
-
overrideSource
Description copied from class:WstxInputSourceMethod that can be called to override originally defined source.- Specified by:
overrideSourcein classWstxInputSource- Parameters:
src- New base URL to set; may be null.
-
fromInternalEntity
public abstract boolean fromInternalEntity()- Specified by:
fromInternalEntityin classWstxInputSource- Returns:
- True, if this input source was directly expanded from an internal entity (general, parsed); false if not (from external entity, DTD ext. subset, main document)
-
getSource
- Specified by:
getSourcein classWstxInputSource- Throws:
IOException
-
getPublicId
- Specified by:
getPublicIdin classWstxInputSource
-
getSystemId
- Specified by:
getSystemIdin classWstxInputSource
-
doInitInputLocation
- Specified by:
doInitInputLocationin classWstxInputSource
-
readInto
Description copied from class:WstxInputSourceMethod called to read at least one more char from input source, and update input data appropriately.- Specified by:
readIntoin classWstxInputSource- Returns:
- Number of characters read from the input source (at least 1), if it had any input; -1 if input source has no more input.
- Throws:
IOExceptionXMLStreamException
-
readMore
public abstract boolean readMore(WstxInputData reader, int minAmount) throws IOException, XMLStreamException Description copied from class:WstxInputSourceMethod called by reader when it has to have at least specified number of consequtive input characters in its buffer, and it currently does not have. If so, it asks input source to do whatever it has to do to try to get more data, if possible (including moving stuff in input buffer if necessary and possible).- Specified by:
readMorein classWstxInputSource- Returns:
- True if input source was able to provide specific number of characters or more; false if not. In latter case, source is free to return zero or more characters any way.
- Throws:
IOExceptionXMLStreamException
-
saveContext
Description copied from class:WstxInputSourceMethod Reader calls when this input source is being stored, when a nested input source gets used instead (due to entity expansion). Needs to get location info from Reader and store it in this Object.- Specified by:
saveContextin classWstxInputSource
-
restoreContext
Description copied from class:WstxInputSourceMethod Reader calls when this input source is resumed as the current source. Needs to update Reader's input location data used for error messages etc.- Specified by:
restoreContextin classWstxInputSource
-
close
Description copied from class:WstxInputSourceMethod reader calls for this input source when it has encountered EOF. This may or may not close the underlying stream/reader; what happens depends on configuration- Specified by:
closein classWstxInputSource- Throws:
IOException
-
getLocation
This method only gets called by the 'child' input source (for example, contents of an expanded entity), to get the enclosing context location.- Specified by:
getLocationin classWstxInputSource
-
getLocation
- Specified by:
getLocationin classWstxInputSource
-