org.apache.regexp

Class StreamCharacterIterator

public final class StreamCharacterIterator extends Object implements 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
StringBufferbuff
Buffer of read chars
booleanclosed
read end?
InputStreamis
Underlying is
Constructor Summary
StreamCharacterIterator(InputStream is)
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?

is

private final InputStream is
Underlying is

Constructor Detail

StreamCharacterIterator

public StreamCharacterIterator(InputStream is)

Parameters: is an InputStream, 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.