com.ctc.wstx.io
Class UTF8Reader

java.lang.Object
  extended byjava.io.Reader
      extended bycom.ctc.wstx.io.BaseReader
          extended bycom.ctc.wstx.io.UTF8Reader

public final class UTF8Reader
extends com.ctc.wstx.io.BaseReader

Optimized Reader that reads UTF-8 encoded content from an input stream. In addition to doing (hopefully) optimal conversion, it can also take array of "pre-read" (leftover) bytes; this is necessary when preliminary stream/reader is trying to figure out XML encoding.


Field Summary
protected  byte[] mBuffer
           
protected  java.io.InputStream mIn
           
protected  int mLength
           
protected  int mPtr
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
UTF8Reader(java.io.InputStream in, byte[] buf, int ptr, int len)
           
 
Method Summary
 void close()
           
 int read()
          Although this method is implemented by the base class, AND it should never be called by Woodstox code, let's still implement it bit more efficiently just in case
 int read(char[] cbuf, int start, int len)
           
protected  void reportBounds(char[] cbuf, int start, int len)
           
protected  void reportStrangeStream()
           
 
Methods inherited from class java.io.Reader
mark, markSupported, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mIn

protected java.io.InputStream mIn

mBuffer

protected byte[] mBuffer

mPtr

protected int mPtr

mLength

protected int mLength
Constructor Detail

UTF8Reader

public UTF8Reader(java.io.InputStream in,
                  byte[] buf,
                  int ptr,
                  int len)
Method Detail

read

public int read(char[] cbuf,
                int start,
                int len)
         throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Although this method is implemented by the base class, AND it should never be called by Woodstox code, let's still implement it bit more efficiently just in case

Throws:
java.io.IOException

reportBounds

protected void reportBounds(char[] cbuf,
                            int start,
                            int len)
                     throws java.io.IOException
Throws:
java.io.IOException

reportStrangeStream

protected void reportStrangeStream()
                            throws java.io.IOException
Throws:
java.io.IOException