public class UnicodeUnescapeReader
extends java.io.FilterReader
FilterReader
that unescapes the "Unicode Escapes" as described in JLS7 3.10.6.
Notice that it is possible to formulate invalid escape sequences, e.g. "\u123g" ("g" is not a valid hex
character). This is handled by throwing a RuntimeException
-derived UnicodeUnescapeException
.
Modifier and Type | Field and Description |
---|---|
private boolean |
oddPrecedingBackslashes |
private int |
unreadChar |
Constructor and Description |
---|
UnicodeUnescapeReader(java.io.Reader in) |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Simple unit testing.
|
int |
read()
Override
FilterReader.read() . |
int |
read(char[] cbuf,
int off,
int len)
Overrides
FilterReader.read(char[], int, int) . |
private int unreadChar
private boolean oddPrecedingBackslashes
public int read() throws java.io.IOException
FilterReader.read()
.read
in class java.io.FilterReader
UnicodeUnescapeException
- Invalid escape sequence encounteredjava.io.IOException
public int read(char[] cbuf, int off, int len) throws java.io.IOException
FilterReader.read(char[], int, int)
.read
in class java.io.FilterReader
java.io.IOException
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException