Package org.codehaus.janino
Class UnicodeUnescapeReader
- java.lang.Object
-
- java.io.Reader
-
- java.io.FilterReader
-
- org.codehaus.janino.UnicodeUnescapeReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
public class UnicodeUnescapeReader extends FilterReader
AFilterReader
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
-derivedUnicodeUnescapeException
.
-
-
Field Summary
-
Fields inherited from class java.io.FilterReader
in
-
-
Constructor Summary
Constructors Constructor Description UnicodeUnescapeReader(Reader in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(String[] args)
Simple unit testing.int
read()
OverrideFilterReader.read()
.int
read(char[] cbuf, int off, int len)
OverridesFilterReader.read(char[], int, int)
.-
Methods inherited from class java.io.FilterReader
close, mark, markSupported, ready, reset, skip
-
Methods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
-
-
-
Constructor Detail
-
UnicodeUnescapeReader
public UnicodeUnescapeReader(Reader in)
-
-
Method Detail
-
read
public int read() throws IOException
OverrideFilterReader.read()
.- Overrides:
read
in classFilterReader
- Throws:
UnicodeUnescapeException
- Invalid escape sequence encounteredIOException
-
read
public int read(char[] cbuf, int off, int len) throws IOException
OverridesFilterReader.read(char[], int, int)
.- Overrides:
read
in classFilterReader
- Throws:
IOException
-
main
public static void main(String[] args) throws IOException
Simple unit testing.- Throws:
IOException
-
-