public class LocationAwareReader extends FilterReader implements ILocationProvider
A common pitfall is to read the ILocationProvider via a BufferedReader - this will certainly not provide with a correct character location!
| Constructor and Description |
|---|
LocationAwareReader(Reader in) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
ensureOpen() |
int |
getColumn() |
int |
getLine() |
int |
getPosition() |
int |
read() |
int |
read(char[] cbuf,
int off,
int len) |
void |
setColumn(int column) |
void |
setLine(int line) |
void |
setLocation(int line,
int column)
Offset the current location to a user defined line and column.
|
void |
setPosition(int position) |
long |
skip(long n) |
mark, markSupported, ready, resetpublic LocationAwareReader(Reader in)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterReaderIOExceptionpublic void ensureOpen()
throws IOException
IOExceptionpublic int getColumn()
getColumn in interface ILocationProviderpublic int getLine()
getLine in interface ILocationProviderpublic int getPosition()
getPosition in interface ILocationProviderpublic int read()
throws IOException
read in class FilterReaderIOExceptionpublic int read(char[] cbuf,
int off,
int len)
throws IOException
read in class FilterReaderIOExceptionpublic void setColumn(int column)
column - The column to set.public void setLine(int line)
line - The line to set.public void setLocation(int line,
int column)
line - The line we want the reader to accept as new locationcolumn - The column we want the reader to accept as new locationpublic void setPosition(int position)
position - The position to set.public long skip(long n)
throws IOException
skip in class FilterReaderIOExceptionCopyright © 2013 intarsys consulting GmbH. All Rights Reserved.