Package org.apache.regexp
Class StreamCharacterIterator
java.lang.Object
org.apache.regexp.StreamCharacterIterator
- All Implemented Interfaces:
CharacterIterator
Encapsulates java.io.InputStream as CharacterIterator.
- Version:
- CVS $Id: StreamCharacterIterator.java 518156 2007-03-14 14:31:26Z vgritsenko $
- Author:
- Ales Novak
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuffer
Buffer of read charsprivate boolean
read end?private final InputStream
Underlying is -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchar
charAt
(int pos) private void
ensure
(int idx) Reads chars up to the idxboolean
isEnd
(int pos) private int
read
(int n) Reads n characters from the stream and appends them to the bufferprivate void
readAll()
Reads rest of the stream.substring
(int beginIndex) substring
(int beginIndex, int endIndex)
-
Field Details
-
is
Underlying is -
buff
Buffer of read chars -
closed
private boolean closedread end?
-
-
Constructor Details
-
StreamCharacterIterator
- Parameters:
is
- an InputStream, which is parsed
-
-
Method Details
-
substring
- Specified by:
substring
in interfaceCharacterIterator
- Returns:
- a substring
-
substring
- Specified by:
substring
in interfaceCharacterIterator
- Returns:
- a substring
-
charAt
public char charAt(int pos) - Specified by:
charAt
in interfaceCharacterIterator
- Returns:
- a character at the specified position.
-
isEnd
public boolean isEnd(int pos) - Specified by:
isEnd
in 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
-