com.github.abrarsyed.jastyle.reader
Class ExtendedReader
java.lang.Object
java.io.Reader
com.github.abrarsyed.jastyle.reader.ExtendedReader
- All Implemented Interfaces:
- java.io.Closeable, java.lang.Readable
public class ExtendedReader
- extends java.io.Reader
A Reader that provides some additional functionality, such as peek(). This is
a modified version of original ExtendedReader used in the Apache Tapestry Project.
- Since:
- 4.0
| Fields inherited from class java.io.Reader |
lock |
|
Constructor Summary |
ExtendedReader(java.io.Reader in)
Creates a new extended reader that reads from the provided object. |
|
Method Summary |
void |
close()
|
boolean |
isEndOfStream()
Determines whether the end of the stream is reached. |
void |
mark(int readAheadLimit)
|
boolean |
markSupported()
|
int |
peek()
Returns the next character in the stream without actually comitting the
read. |
int |
read(char[] cbuf,
int off,
int len)
|
boolean |
ready()
|
void |
reset()
|
long |
skip(long n)
|
| Methods inherited from class java.io.Reader |
read, read, read |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExtendedReader
public ExtendedReader(java.io.Reader in)
- Creates a new extended reader that reads from the provided object.
- Parameters:
in - the Reader to get data from
peek
public int peek()
throws java.io.IOException
- Returns the next character in the stream without actually comitting the
read. Multiple consequtive invocations of this method should return the
same value.
- Returns:
- the next character waiting in the stream or -1 if the end of the
stream is reached
- Throws:
java.io.IOException - if an error occurs
isEndOfStream
public boolean isEndOfStream()
throws java.io.IOException
- Determines whether the end of the stream is reached.
- Returns:
- true if at the end of stream
- Throws:
java.io.IOException - if an error occurs
read
public int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
- Specified by:
read in class java.io.Reader
- Throws:
java.io.IOException- See Also:
FilterReader.read(char[], int, int)
ready
public boolean ready()
throws java.io.IOException
- Overrides:
ready in class java.io.Reader
- Throws:
java.io.IOException- See Also:
FilterReader.ready()
markSupported
public boolean markSupported()
- Overrides:
markSupported in class java.io.Reader
- See Also:
FilterReader.markSupported()
mark
public void mark(int readAheadLimit)
throws java.io.IOException
- Overrides:
mark in class java.io.Reader
- Throws:
java.io.IOException
reset
public void reset()
throws java.io.IOException
- Overrides:
reset in class java.io.Reader
- Throws:
java.io.IOException- See Also:
FilterReader.reset()
skip
public long skip(long n)
throws java.io.IOException
- Overrides:
skip in class java.io.Reader
- Throws:
java.io.IOException- See Also:
FilterReader.skip(long)
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Specified by:
close in class java.io.Reader
- Throws:
java.io.IOException- See Also:
Reader.close()