Package org.codehaus.groovy.antlr
Class UnicodeEscapingReader
- java.lang.Object
-
- java.io.Reader
-
- org.codehaus.groovy.antlr.UnicodeEscapingReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
public class UnicodeEscapingReader extends java.io.ReaderTranslates GLS-defined unicode escapes into characters. Throws an exception in the event of an invalid unicode escape being detected.No attempt has been made to optimize this class for speed or space.
-
-
Constructor Summary
Constructors Constructor Description UnicodeEscapingReader(java.io.Reader reader, SourceBuffer sourceBuffer)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this reader by calling close on the underlying reader.intgetUnescapedUnicodeColumnCount()intgetUnescapedUnicodeOffsetCount()intread()Gets the next character from the underlying reader, translating escapes as required.intread(char[] cbuf, int off, int len)Reads characters from the underlying reader.voidsetLexer(CharScanner lexer)Sets the lexer that is using this reader.
-
-
-
Constructor Detail
-
UnicodeEscapingReader
public UnicodeEscapingReader(java.io.Reader reader, SourceBuffer sourceBuffer)Constructor.- Parameters:
reader- The reader that this reader will filter over.
-
-
Method Detail
-
setLexer
public void setLexer(CharScanner lexer)
Sets the lexer that is using this reader. Must be called before the lexer is used.
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOExceptionReads characters from the underlying reader.- Specified by:
readin classjava.io.Reader- Throws:
java.io.IOException- See Also:
Reader.read(char[],int,int)
-
read
public int read() throws java.io.IOExceptionGets the next character from the underlying reader, translating escapes as required.- Overrides:
readin classjava.io.Reader- Throws:
java.io.IOException- See Also:
Reader.close()
-
getUnescapedUnicodeColumnCount
public int getUnescapedUnicodeColumnCount()
-
getUnescapedUnicodeOffsetCount
public int getUnescapedUnicodeOffsetCount()
-
close
public void close() throws java.io.IOExceptionCloses this reader by calling close on the underlying reader.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Reader- Throws:
java.io.IOException- See Also:
Reader.close()
-
-