com.ctc.wstx.io
Class ReaderSource

java.lang.Object
  extended bycom.ctc.wstx.io.WstxInputSource
      extended bycom.ctc.wstx.io.BaseInputSource
          extended bycom.ctc.wstx.io.ReaderSource
Direct Known Subclasses:
BranchingReaderSource

public class ReaderSource
extends BaseInputSource

Input source that reads input via a Reader.


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
ReaderSource(WstxInputSource parent, java.lang.String fromEntity, java.lang.String pubId, java.lang.String sysId, java.net.URL src, java.io.Reader r, boolean realClose, int bufSize)
           
 
Method Summary
 void close()
           
 int getInputBufferLength()
           
 void initInputLocation(WstxInputData reader)
          Input location is easy to set, as we'll start from the beginning of a File.
 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 setInputOffsets(int proc, int row, int rowStart)
          Method called to change the default offsets this source has.
 
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
getParent, hasRecursion, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReaderSource

public ReaderSource(WstxInputSource parent,
                    java.lang.String fromEntity,
                    java.lang.String pubId,
                    java.lang.String sysId,
                    java.net.URL src,
                    java.io.Reader r,
                    boolean realClose,
                    int bufSize)
Method Detail

setInputOffsets

public void setInputOffsets(int proc,
                            int row,
                            int rowStart)
Method called to change the default offsets this source has. Generally done when the underlying Reader had been partially read earlier (like reading the xml declaration before starting real parsing).


initInputLocation

public void initInputLocation(WstxInputData reader)
Input location is easy to set, as we'll start from the beginning of a File.

Specified by:
initInputLocation in class BaseInputSource

getInputBufferLength

public int getInputBufferLength()
Specified by:
getInputBufferLength in class BaseInputSource
Returns:
Length of suggested input buffer (if source needs one); used for passing default buffer size down the input source line.

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.

Specified by:
readInto in class BaseInputSource
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).

Specified by:
readMore in class BaseInputSource
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in class BaseInputSource
Throws:
java.io.IOException