com.google.gdata.util.io.base
Class UnicodeReader
java.lang.Object
java.io.Reader
com.google.gdata.util.io.base.UnicodeReader
- All Implemented Interfaces:
- java.io.Closeable, java.lang.Readable
public class UnicodeReader
- extends java.io.Reader
Generic Unicode text reader, which uses a BOM (Byte Order Mark) to identify
the encoding to be used. This also has the side effect of removing the BOM
from the input stream (when present).
- See Also:
-
JDK Bug 4508058
Fields inherited from class java.io.Reader |
lock |
Constructor Summary |
UnicodeReader(java.io.InputStream in,
java.lang.String defaultEnc)
|
Methods inherited from class java.io.Reader |
mark, markSupported, read, read, read, ready, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnicodeReader
public UnicodeReader(java.io.InputStream in,
java.lang.String defaultEnc)
throws java.io.IOException
- Parameters:
in
- input streamdefaultEnc
- default encoding (used only if BOM is not found) or
null
to use system default
- Throws:
java.io.IOException
- if an I/O error occurs
getDefaultEncoding
public java.lang.String getDefaultEncoding()
getEncoding
public java.lang.String getEncoding()
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Specified by:
close
in class java.io.Reader
- Throws:
java.io.IOException
read
public int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
- Specified by:
read
in class java.io.Reader
- Throws:
java.io.IOException