org.apache.regexp

Class ReaderCharacterIterator

public final class ReaderCharacterIterator extends Object implements 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
StringBufferbuff
Buffer of read chars
booleanclosed
read end?
Readerreader
Underlying reader
Constructor Summary
ReaderCharacterIterator(Reader reader)
Method Summary
charcharAt(int pos)
voidensure(int idx)
Reads chars up to the idx
booleanisEnd(int pos)
intread(int n)
Reads n characters from the stream and appends them to the buffer
voidreadAll()
Reads rest of the stream.
Stringsubstring(int beginIndex, int endIndex)
Stringsubstring(int beginIndex)

Field Detail

buff

private final StringBuffer buff
Buffer of read chars

closed

private boolean closed
read end?

reader

private final Reader reader
Underlying reader

Constructor Detail

ReaderCharacterIterator

public ReaderCharacterIterator(Reader reader)

Parameters: reader a Reader, which is parsed

Method Detail

charAt

public char charAt(int pos)

Returns: a character at the specified position.

ensure

private void ensure(int idx)
Reads chars up to the idx

isEnd

public boolean isEnd(int pos)

Returns: true iff if the specified index is after the end of the character stream

read

private int read(int n)
Reads n characters from the stream and appends them to the buffer

readAll

private void readAll()
Reads rest of the stream.

substring

public String substring(int beginIndex, int endIndex)

Returns: a substring

substring

public String substring(int beginIndex)

Returns: a substring

Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.