Package com.ctc.wstx.io
Class BranchingReaderSource
java.lang.Object
com.ctc.wstx.io.WstxInputSource
com.ctc.wstx.io.BaseInputSource
com.ctc.wstx.io.ReaderSource
com.ctc.wstx.io.BranchingReaderSource
Specialized input source that can "branch" input it reads; essentially
both giving out read data AND also writing it out to a Writer.
Currently this Reader is only used as the main-level Reader, to allow for branching of internal DTD subset to a text buffer if necessary.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) TextBuffer
(package private) int
(package private) boolean
(package private) boolean
Flag that indicates that last char from previous buffer was '\r', and that following '\n' (if there is one) needs to be ignored.Fields inherited from class com.ctc.wstx.io.ReaderSource
mConfig, mDoRealClose, mInputProcessed, mInputRow, mInputRowStart, mReader
Fields inherited from class com.ctc.wstx.io.BaseInputSource
mBuffer, mInputLast, mParentLocation, mPublicId, mSavedInputProcessed, mSavedInputPtr, mSavedInputRow, mSavedInputRowStart, mSystemId
Fields inherited from class com.ctc.wstx.io.WstxInputSource
mEntityDepth, mFromEntity, mParent, mScopeId
-
Constructor Summary
ConstructorsConstructorDescriptionBranchingReaderSource
(ReaderConfig cfg, String pubId, SystemId sysId, Reader r, boolean realClose) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
appendBranched
(int startOffset, int pastEnd) void
endBranch
(int endOffset) Currently this input source does not implement branchingint
readInto
(WstxInputData reader) Method called to read at least one more char from input source, and update input data appropriately.boolean
readMore
(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.void
startBranch
(TextBuffer tb, int startOffset, boolean convertLFs) Methods inherited from class com.ctc.wstx.io.ReaderSource
close, closeCompletely, doInitInputLocation, fromInternalEntity, setInputOffsets
Methods inherited from class com.ctc.wstx.io.BaseInputSource
getLocation, getLocation, getPublicId, getSource, getSystemId, overrideSource, restoreContext, saveContext
Methods inherited from class com.ctc.wstx.io.WstxInputSource
getEntityDepth, getEntityId, getParent, getScopeId, initInputLocation, isOrIsExpandedFrom, toString
-
Field Details
-
mBranchBuffer
TextBuffer mBranchBuffer -
mBranchStartOffset
int mBranchStartOffset -
mConvertLFs
boolean mConvertLFs -
mGotCR
boolean mGotCRFlag that indicates that last char from previous buffer was '\r', and that following '\n' (if there is one) needs to be ignored.
-
-
Constructor Details
-
BranchingReaderSource
public BranchingReaderSource(ReaderConfig cfg, String pubId, SystemId sysId, Reader r, boolean realClose)
-
-
Method Details
-
readInto
Description copied from class:WstxInputSource
Method called to read at least one more char from input source, and update input data appropriately.- Overrides:
readInto
in classReaderSource
- 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:
IOException
XMLStreamException
-
readMore
Description copied from class:WstxInputSource
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).- Overrides:
readMore
in classReaderSource
- 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:
IOException
XMLStreamException
-
startBranch
-
endBranch
public void endBranch(int endOffset) Currently this input source does not implement branching -
appendBranched
private void appendBranched(int startOffset, int pastEnd)
-