com.ctc.wstx.io
Class BranchingReaderSource

java.lang.Object
  extended by com.ctc.wstx.io.WstxInputSource
      extended by com.ctc.wstx.io.BaseInputSource
          extended by com.ctc.wstx.io.ReaderSource
              extended by com.ctc.wstx.io.BranchingReaderSource

public final class BranchingReaderSource
extends ReaderSource

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
 
Fields inherited from class com.ctc.wstx.io.BaseInputSource
mBuffer, mInputLen
 
Fields inherited from class com.ctc.wstx.io.WstxInputSource
mParent
 
Constructor Summary
BranchingReaderSource(ReaderConfig cfg, java.lang.String pubId, java.lang.String sysId, java.net.URL src, java.io.Reader r, boolean realClose)
           
 
Method Summary
 void endBranch(int endOffset)
          Currently this input source does not implement branching
 int 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, restoreContext, saveContext
 
Methods inherited from class com.ctc.wstx.io.WstxInputSource
getEntityId, getParent, getScopeId, initInputLocation, isOrIsExpandedFrom, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BranchingReaderSource

public BranchingReaderSource(ReaderConfig cfg,
                             java.lang.String pubId,
                             java.lang.String sysId,
                             java.net.URL src,
                             java.io.Reader r,
                             boolean realClose)
Method Detail

readInto

public int readInto(WstxInputData reader)
             throws java.io.IOException
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 class ReaderSource
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:
java.io.IOException

readMore

public boolean readMore(WstxInputData reader,
                        int minAmount)
                 throws java.io.IOException
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 class ReaderSource
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:
java.io.IOException

startBranch

public void startBranch(TextBuffer tb,
                        int startOffset,
                        boolean convertLFs)

endBranch

public void endBranch(int endOffset)
Currently this input source does not implement branching