at.dms.util
Class UnicodeReader
java.lang.Object
java.io.Reader
java.io.FilterReader
at.dms.util.UnicodeReader
- All Implemented Interfaces:
- Closeable, Readable
public class UnicodeReader
- extends FilterReader
A character-stream reader that transforms unicode escape sequences
into characters according to the Java Language Specification - Second Edition.
See JLS 3.2 : Lexical Translations, Step 1
See JLS 3.3 : Unicode Escapes
NOTE: we use a lookahead character instead of a pushback reader because
for example the sequence "\\u..." would be read as "\" and "\ u . . ."
Method Summary |
boolean |
markSupported()
Tell whether this stream supports the mark() operation. |
int |
read()
Reads a single character. |
int |
read(char[] buf,
int off,
int len)
Reads characters into a portion of an array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnicodeReader
public UnicodeReader(Reader in)
- Creates a new unicode reader.
- Parameters:
in
- the reader from which characters will be read
read
public int read()
throws IOException
- Reads a single character.
- Overrides:
read
in class FilterReader
- Returns:
- the character read, or -1 if the end of the stream has been reached
- Throws:
IOException
- if an I/O error occurs
read
public int read(char[] buf,
int off,
int len)
throws IOException
- Reads characters into a portion of an array.
- Overrides:
read
in class FilterReader
- Parameters:
buf
- destination bufferoff
- offset at which to start writing characterslen
- maximum number of characters to read
- Returns:
- the number of characters read, or -1 if the end of the stream has been reached
- Throws:
IOException
- if an I/O error occurs
markSupported
public boolean markSupported()
- Tell whether this stream supports the mark() operation.
- Overrides:
markSupported
in class FilterReader
- Returns:
- false: this stream does not support mark()