@ThreadSafe
public class UnicodeStreamReader
extends Reader
Supports UTF-8 with optional BOM and UTF-16(BE/LE).
Note: when the BOM is absent, the presence of a 0x00 byte in only one of the first two bytes is used to recognize UTF-16.
Constructor and Description |
---|
UnicodeStreamReader(File inputFile)
Constructs an instance.
|
UnicodeStreamReader(InputStream stream)
Constructs an instance.
|
UnicodeStreamReader(String inputPath)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
String |
getEncoding()
Gets the name of the character set encoding detected.
|
int |
read() |
int |
read(char[] buffer,
int offset,
int length) |
boolean |
ready() |
public UnicodeStreamReader(@Nonnull File inputFile) throws FileNotFoundException
inputFile
- The input file.FileNotFoundException
- When the file is not found.public UnicodeStreamReader(@Nonnull InputStream stream)
stream
- The Unicode input stream.public UnicodeStreamReader(@Nonnull String inputPath) throws FileNotFoundException
inputPath
- The input path.FileNotFoundException
- When the file is not found.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Reader
IOException
@Nonnull @CheckReturnValue public String getEncoding() throws IOException
IOException
- When an I/O error occurs.public int read() throws IOException
read
in class Reader
IOException
public int read(char[] buffer, int offset, int length) throws IOException
read
in class Reader
IOException
public boolean ready() throws IOException
ready
in class Reader
IOException
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.