org.riotfamily.common.io
Class UnicodeStreamReader
java.lang.Object
java.io.Reader
org.riotfamily.common.io.UnicodeStreamReader
- All Implemented Interfaces:
- Closeable, Readable
public class UnicodeStreamReader
- extends Reader
Reader that uses a Byte Order Mark (BOM) to identify the encoding of the
underlying stream. If present, the BOM is removed from the stream.
- Since:
- 7.0
- Author:
- Felix Gnass [fgnass at neteye dot de]
- See Also:
- JDK Bug 4508058,
Byte Order Mark FAQ
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnicodeStreamReader
public UnicodeStreamReader(InputStream in)
throws IOException
- Creates a new UnicodeStreamReader. If no BOM is found in the stream
the default system encoding is used.
- Parameters:
in
- An InputStream
- Throws:
IOException
- If an I/O error occurs
UnicodeStreamReader
public UnicodeStreamReader(InputStream in,
String defaultEncoding)
throws IOException
- Creates a new UnicodeStreamReader. If no BOM is found in the stream
the given default encoding is used.
- Parameters:
in
- An InputStreamdefaultEncoding
- The encoding to be used if no BOM is found
- Throws:
IOException
- If an I/O error occurs
getEncoding
public String getEncoding()
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Specified by:
close
in class Reader
- Throws:
IOException
read
public int read(char[] cbuf,
int off,
int len)
throws IOException
- Specified by:
read
in class Reader
- Throws:
IOException