com.caucho.vfs.i18n
Class UTF8Reader
java.lang.Object
java.io.Reader
com.caucho.vfs.i18n.EncodingReader
com.caucho.vfs.i18n.UTF8Reader
- All Implemented Interfaces:
- java.io.Closeable, java.lang.Readable
public class UTF8Reader
- extends EncodingReader
Implements an encoding reader for UTF8.
Fields inherited from class java.io.Reader |
lock |
Constructor Summary |
UTF8Reader()
Null-arg constructor for instantiation by com.caucho.vfs.Encoding only. |
Method Summary |
java.io.Reader |
create(java.io.InputStream is,
java.lang.String javaEncoding)
Create a UTF-8 reader based on the readStream. |
int |
read()
Reads into a character buffer using the correct encoding. |
int |
read(char[] cbuf,
int off,
int len)
Reads into a character buffer using the correct encoding. |
Methods inherited from class java.io.Reader |
mark, markSupported, read, read, ready, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UTF8Reader
public UTF8Reader()
- Null-arg constructor for instantiation by com.caucho.vfs.Encoding only.
create
public java.io.Reader create(java.io.InputStream is,
java.lang.String javaEncoding)
- Create a UTF-8 reader based on the readStream.
- Specified by:
create
in class EncodingReader
- Parameters:
is
- the input stream providing the bytes.javaEncoding
- the JDK name for the encoding.
- Returns:
- the UTF-8 reader.
read
public int read()
throws java.io.IOException
- Reads into a character buffer using the correct encoding.
- Specified by:
read
in class EncodingReader
- Returns:
- the next character or -1 on end of file.
- Throws:
java.io.IOException
read
public int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
- Reads into a character buffer using the correct encoding.
- Overrides:
read
in class EncodingReader
- Parameters:
cbuf
- character buffer receiving the data.off
- starting offset into the buffer.len
- number of characters to read.
- Returns:
- the number of characters read or -1 on end of file.
- Throws:
java.io.IOException