public abstract class EncodingReader
extends java.io.Reader
create
and read() at minimum. Efficient implementations will
also implement the read into a buffer.
Implementations should not buffer the bytes.| Constructor and Description |
|---|
EncodingReader() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the reader, possibly returning it to a pool.
|
java.io.Reader |
create(java.io.InputStream is)
Returns a new encoding reader for the given stream and javaEncoding.
|
abstract java.io.Reader |
create(java.io.InputStream is,
java.lang.String javaEncoding)
Returns a new encoding reader for the given stream and javaEncoding.
|
java.lang.String |
getJavaEncoding() |
abstract int |
read()
Returns the next character using the correct encoding.
|
int |
read(char[] cbuf,
int off,
int len)
Reads into a character buffer using the correct encoding.
|
void |
setJavaEncoding(java.lang.String encoding) |
public java.lang.String getJavaEncoding()
public void setJavaEncoding(java.lang.String encoding)
public abstract java.io.Reader create(java.io.InputStream is,
java.lang.String javaEncoding)
throws java.io.UnsupportedEncodingException
is - the input stream providing the bytes.javaEncoding - the JDK name for the encoding.java.io.UnsupportedEncodingExceptionpublic java.io.Reader create(java.io.InputStream is)
throws java.io.UnsupportedEncodingException
is - the input stream providing the bytes.javaEncoding - the JDK name for the encoding.java.io.UnsupportedEncodingExceptionpublic abstract int read()
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionpublic int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
read in class java.io.Readercbuf - character buffer receiving the data.off - starting offset into the buffer.len - number of characters to read.java.io.IOExceptionpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Reader