Package org.apache.regexp
Class ReaderCharacterIterator
java.lang.Object
org.apache.regexp.ReaderCharacterIterator
- All Implemented Interfaces:
CharacterIterator
Encapsulates java.io.Reader as CharacterIterator
- Version:
- CVS $Id: ReaderCharacterIterator.java 518156 2007-03-14 14:31:26Z vgritsenko $
- Author:
- Ales Novak
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBufferBuffer of read charsprivate booleanread end?private final ReaderUnderlying reader -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncharcharAt(int pos) private voidensure(int idx) Reads chars up to the idxbooleanisEnd(int pos) private intread(int n) Reads n characters from the stream and appends them to the bufferprivate voidreadAll()Reads rest of the stream.substring(int beginIndex) substring(int beginIndex, int endIndex)
-
Field Details
-
reader
Underlying reader -
buff
Buffer of read chars -
closed
private boolean closedread end?
-
-
Constructor Details
-
ReaderCharacterIterator
- Parameters:
reader- a Reader, which is parsed
-
-
Method Details
-
substring
- Specified by:
substringin interfaceCharacterIterator- Returns:
- a substring
-
substring
- Specified by:
substringin interfaceCharacterIterator- Returns:
- a substring
-
charAt
public char charAt(int pos) - Specified by:
charAtin interfaceCharacterIterator- Returns:
- a character at the specified position.
-
isEnd
public boolean isEnd(int pos) - Specified by:
isEndin interfaceCharacterIterator- Returns:
- true iff if the specified index is after the end of the character stream
-
read
Reads n characters from the stream and appends them to the buffer- Throws:
IOException
-
readAll
Reads rest of the stream.- Throws:
IOException
-
ensure
Reads chars up to the idx- Throws:
IOException
-