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

public abstract Class BaseInputSource

extends WstxInputSource
Class Inheritance
Known Direct Subclasses
com.ctc.wstx.io.CharArraySource, com.ctc.wstx.io.ReaderSource
Imports
java.io.IOException, java.net.URL, javax.xml.stream.XMLStreamException

Abstract base class that implements shared functionality that all current WstxInputSource implementations Woodstox includes need.

Field Summary

Modifier and TypeField and Description
protected char[]
mBuffer

Input buffer this input source uses, if any.

protected int
mInputLast

Length of the buffer, if buffer used

pack-priv transient WstxInputLocation
pack-priv final String
pack-priv long
mSavedInputProcessed

Number of characters read from the current input source prior to the current buffer

pack-priv int
pack-priv int
pack-priv int
pack-priv SystemId
mSystemId

URL for/from systemId points to original source of input, if known; null if not known (source constructed with just a stream or reader).

Inherited from com.ctc.wstx.io.WstxInputSource:
mEntityDepthmFromEntitymParentmScopeId

Constructor Summary

AccessConstructor and Description
protected
BaseInputSource(WstxInputSource parent, String fromEntity, String publicId, SystemId systemId)

Method Summary

Modifier and TypeMethod and Description
public abstract void
close()

Implements abstract com.ctc.wstx.io.WstxInputSource.close.

Method reader calls for this input source when it has encountered EOF.

protected abstract void
public abstract boolean
protected final WstxInputLocation
getLocation()

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

This method only gets called by the 'child' input source (for example, contents of an expanded entity), to get the enclosing context location.

public final WstxInputLocation
getLocation(long total, int row, int col)

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

public String
public URL
public String
public void
overrideSource(URL
New base URL to set; may be null.
src
)

Implements abstract com.ctc.wstx.io.WstxInputSource.overrideSource.

Method that can be called to override originally defined source.

public abstract int
readInto(WstxInputData reader)

Implements abstract com.ctc.wstx.io.WstxInputSource.readInto.

Method called to read at least one more char from input source, and update input data appropriately.

public abstract boolean
readMore(WstxInputData reader, int minAmount)

Implements abstract com.ctc.wstx.io.WstxInputSource.readMore.

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.

public void
restoreContext(WstxInputData reader)

Implements abstract com.ctc.wstx.io.WstxInputSource.restoreContext.

Method Reader calls when this input source is resumed as the current source.

public void
saveContext(WstxInputData reader)

Implements abstract com.ctc.wstx.io.WstxInputSource.saveContext.

Method Reader calls when this input source is being stored, when a nested input source gets used instead (due to entity expansion).

Inherited from com.ctc.wstx.io.WstxInputSource:
closeCompletelygetEntityDepthgetEntityIdgetParentgetScopeIdinitInputLocationisOrIsExpandedFromtoString

Field Detail

mBufferback to summary
protected char[] mBuffer

Input buffer this input source uses, if any.

mInputLastback to summary
protected int mInputLast

Length of the buffer, if buffer used

mParentLocationback to summary
pack-priv transient WstxInputLocation mParentLocation
mPublicIdback to summary
pack-priv final String mPublicId
mSavedInputProcessedback to summary
pack-priv long mSavedInputProcessed

Number of characters read from the current input source prior to the current buffer

mSavedInputPtrback to summary
pack-priv int mSavedInputPtr
mSavedInputRowback to summary
pack-priv int mSavedInputRow
mSavedInputRowStartback to summary
pack-priv int mSavedInputRowStart
mSystemIdback to summary
pack-priv SystemId mSystemId

URL 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.

Constructor Detail

BaseInputSourceback to summary
protected BaseInputSource(WstxInputSource parent, String fromEntity, String publicId, SystemId systemId)

Method Detail

closeback to summary
public abstract void close() throws IOException

Implements abstract com.ctc.wstx.io.WstxInputSource.close.

Doc from com.ctc.wstx.io.WstxInputSource.close.

Method 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

Annotations
@Override
doInitInputLocationback to summary
protected abstract void doInitInputLocation(WstxInputData reader)

Implements abstract com.ctc.wstx.io.WstxInputSource.doInitInputLocation.

Annotations
@Override
fromInternalEntityback to summary
public abstract boolean fromInternalEntity()

Implements abstract com.ctc.wstx.io.WstxInputSource.fromInternalEntity.

Returns:boolean

Doc from com.ctc.wstx.io.WstxInputSource.fromInternalEntity.

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)

Annotations
@Override
getLocationback to summary
protected final WstxInputLocation getLocation()

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

This method only gets called by the 'child' input source (for example, contents of an expanded entity), to get the enclosing context location.

Annotations
@Override
getLocationback to summary
public final WstxInputLocation getLocation(long total, int row, int col)

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

Annotations
@Override
getPublicIdback to summary
public String getPublicId()

Implements abstract com.ctc.wstx.io.WstxInputSource.getPublicId.

Annotations
@Override
getSourceback to summary
public URL getSource() throws IOException

Implements abstract com.ctc.wstx.io.WstxInputSource.getSource.

Annotations
@Override
getSystemIdback to summary
public String getSystemId()

Implements abstract com.ctc.wstx.io.WstxInputSource.getSystemId.

Annotations
@Override
overrideSourceback to summary
public void overrideSource(URL src)

Implements abstract com.ctc.wstx.io.WstxInputSource.overrideSource.

Doc from com.ctc.wstx.io.WstxInputSource.overrideSource.

Method that can be called to override originally defined source.

Parameters
src:URL

New base URL to set; may be null.

Annotations
@Override
readIntoback to summary
public abstract int readInto(WstxInputData reader) throws IOException, XMLStreamException

Implements abstract com.ctc.wstx.io.WstxInputSource.readInto.

Doc from com.ctc.wstx.io.WstxInputSource.readInto.

Method called to read at least one more char from input source, and update input data appropriately.

Returns:int

Number of characters read from the input source (at least 1), if it had any input; -1 if input source has no more input.

Annotations
@Override
readMoreback to summary
public abstract boolean readMore(WstxInputData reader, int minAmount) throws IOException, XMLStreamException

Implements abstract com.ctc.wstx.io.WstxInputSource.readMore.

Doc from com.ctc.wstx.io.WstxInputSource.readMore.

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

Returns:boolean

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.

Annotations
@Override
restoreContextback to summary
public void restoreContext(WstxInputData reader)

Implements abstract com.ctc.wstx.io.WstxInputSource.restoreContext.

Doc from com.ctc.wstx.io.WstxInputSource.restoreContext.

Method 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.

Annotations
@Override
saveContextback to summary
public void saveContext(WstxInputData reader)

Implements abstract com.ctc.wstx.io.WstxInputSource.saveContext.

Doc from com.ctc.wstx.io.WstxInputSource.saveContext.

Method 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.

Annotations
@Override