Top Description Fields Constructors Methods
org.codehaus.janino

public Class UnicodeUnescapeReader

extends FilterReader
Class Inheritance
Imports
java.io.FilterReader, .IOException, .Reader, .StringReader, org.codehaus.commons.nullanalysis.Nullable

A 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 java.lang.RuntimeException-derived UnicodeUnescapeException.

Field Summary

Modifier and TypeField and Description
private boolean
private int
Inherited from java.io.FilterReader:
in

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
main(String[] args)

Simple unit testing.

public int
public int
read(char[]
Destination buffer
cbuf
,
int
Offset at which to start storing characters
off
,
int
Maximum number of characters to read
len
)

Overrides java.io.FilterReader.read.

Overrides FilterReader#read(char[], int, int).
Inherited from java.io.FilterReader:
closemarkmarkSupportedreadyresetskip

Field Detail

oddPrecedingBackslashesback to summary
private boolean oddPrecedingBackslashes
unreadCharback to summary
private int unreadChar

Constructor Detail

UnicodeUnescapeReaderback to summary
public UnicodeUnescapeReader(Reader in)

Method Detail

mainback to summary
public static void main(String[] args) throws IOException

Simple unit testing.

readback to summary
public int read() throws IOException

Overrides java.io.FilterReader.read.

Overrides FilterReader#read().

Returns:int

Doc from java.io.Reader.read.

The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterReader.read.

If an I/O error occurs

UnicodeUnescapeException:
Invalid escape sequence encountered
readback to summary
public int read(char[] cbuf, int off, int len) throws IOException

Overrides java.io.FilterReader.read.

Overrides FilterReader#read(char[], int, int).

Parameters
cbuf:char[]

Doc from java.io.Reader.read.

Destination buffer

off:int

Doc from java.io.Reader.read.

Offset at which to start storing characters

len:int

Doc from java.io.Reader.read.

Maximum number of characters to read

Returns:int

Doc from java.io.Reader.read.

The number of characters read, or -1 if the end of the stream has been reached

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Reader.read.

If an I/O error occurs