org.eclipse.mylyn.wikitext.core.util
Class LocationTrackingReader
java.lang.Object
java.io.Reader
org.eclipse.mylyn.wikitext.core.util.LocationTrackingReader
- All Implemented Interfaces:
- Closeable, Readable
public class LocationTrackingReader
- extends Reader
A reader class that tracks the character offset based on the number of characters read. Also provides a means for
reading lines of text, tracking the offset of the last line read.
- Since:
- 1.0
- Author:
- David Green
Method Summary |
void |
close()
|
int |
getLineNumber()
get the 0-based line number of the last line read. |
int |
getLineOffset()
Get the character offset of the first character of the last line read. |
int |
getOffset()
Get the character offset of the last character read. |
int |
read()
|
int |
read(char[] cbuf,
int off,
int len)
|
String |
readLine()
Read a line of text, omitting the line delimiters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LocationTrackingReader
public LocationTrackingReader(Reader delegate)
LocationTrackingReader
public LocationTrackingReader(Reader delegate,
int bufferSize)
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Specified by:
close
in class Reader
- Throws:
IOException
read
public int read(char[] cbuf,
int off,
int len)
throws IOException
- Specified by:
read
in class Reader
- Throws:
IOException
read
public int read()
throws IOException
- Overrides:
read
in class Reader
- Throws:
IOException
readLine
public String readLine()
throws IOException
- Read a line of text, omitting the line delimiters.
- Returns:
- the text or null if the end of input has been reached
- Throws:
IOException
- See Also:
getLineOffset()
getOffset
public int getOffset()
- Get the character offset of the last character read.
getLineOffset
public int getLineOffset()
- Get the character offset of the first character of the last line read. The result of calling this method is only
meaningful immediately after having called
readLine()
.
- See Also:
readLine()
getLineNumber
public int getLineNumber()
- get the 0-based line number of the last line read. The result of calling this method is only meaningful
immediately after having called
readLine()
.
- See Also:
readLine()
Copyright © 2011 FuseSource, Corp.. All Rights Reserved.