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

public final Class BranchingReaderSource

extends ReaderSource
Class Inheritance
Imports
java.io.IOException, .Reader, javax.xml.stream.XMLStreamException, com.ctc.wstx.api.ReaderConfig, com.ctc.wstx.util.TextBuffer

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

Modifier and TypeField and Description
pack-priv TextBuffer
pack-priv int
pack-priv boolean
pack-priv boolean
mGotCR

Flag that indicates that last char from previous buffer was '\r', and that following '\n' (if there is one) needs to be ignored.

Inherited from com.ctc.wstx.io.ReaderSource:
mConfigmDoRealClosemInputProcessedmInputRowmInputRowStartmReader

Constructor Summary

AccessConstructor and Description
public
BranchingReaderSource(ReaderConfig cfg, String pubId, SystemId sysId, Reader r, boolean realClose)

Method Summary

Modifier and TypeMethod and Description
private void
appendBranched(int startOffset, int pastEnd)

public void
endBranch(int endOffset)

Currently this input source does not implement branching

public int
readInto(WstxInputData reader)

Overrides com.ctc.wstx.io.ReaderSource.readInto.

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

public boolean
readMore(WstxInputData reader, int minAmount)

Overrides com.ctc.wstx.io.ReaderSource.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
startBranch(TextBuffer tb, int startOffset, boolean convertLFs)

Inherited from com.ctc.wstx.io.ReaderSource:
closecloseCompletelydoInitInputLocationfromInternalEntitysetInputOffsets

Field Detail

mBranchBufferback to summary
pack-priv TextBuffer mBranchBuffer
mBranchStartOffsetback to summary
pack-priv int mBranchStartOffset
mConvertLFsback to summary
pack-priv boolean mConvertLFs
mGotCRback to summary
pack-priv boolean mGotCR

Flag that indicates that last char from previous buffer was '\r', and that following '\n' (if there is one) needs to be ignored.

Constructor Detail

BranchingReaderSourceback to summary
public BranchingReaderSource(ReaderConfig cfg, String pubId, SystemId sysId, Reader r, boolean realClose)

Method Detail

appendBranchedback to summary
private void appendBranched(int startOffset, int pastEnd)
endBranchback to summary
public void endBranch(int endOffset)

Currently this input source does not implement branching

readIntoback to summary
public int readInto(WstxInputData reader) throws IOException, XMLStreamException

Overrides com.ctc.wstx.io.ReaderSource.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 boolean readMore(WstxInputData reader, int minAmount) throws IOException, XMLStreamException

Overrides com.ctc.wstx.io.ReaderSource.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
startBranchback to summary
public void startBranch(TextBuffer tb, int startOffset, boolean convertLFs)