Package com.gengoai.io
Class CharsetDetectingReader
- java.lang.Object
-
- java.io.Reader
-
- com.gengoai.io.CharsetDetectingReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
public class CharsetDetectingReader extends Reader
A reader that understands Unicode Byte Order Marks and can also guess the character set if a BOM is not present and a character set has not been specified.
- Author:
- David B. Bracewell
-
-
Constructor Summary
Constructors Constructor Description CharsetDetectingReader(InputStream inStream)
Instantiates a new Espresso reader.CharsetDetectingReader(InputStream inStream, Charset defaultCharset)
Instantiates a new Espresso reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Charset
getCharset()
Gets charset.int
read(char[] cbuf, int off, int len)
-
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
CharsetDetectingReader
public CharsetDetectingReader(InputStream inStream)
Instantiates a new Espresso reader.- Parameters:
inStream
- the in stream
-
CharsetDetectingReader
public CharsetDetectingReader(InputStream inStream, Charset defaultCharset)
Instantiates a new Espresso reader.- Parameters:
inStream
- the in streamdefaultCharset
- the default charset
-
-
Method Detail
-
read
public int read(char[] cbuf, int off, int len) throws IOException
- Specified by:
read
in classReader
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-
getCharset
public Charset getCharset()
Gets charset.- Returns:
- the charset
-
-