FileDocCategorySizeDatePackage
CharacterArrayCharacterIterator.javaAPI DocJava SE 6 API2382Tue Jun 10 00:22:24 BST 2008com.sun.org.apache.regexp.internal

CharacterArrayCharacterIterator

public final class CharacterArrayCharacterIterator extends Object implements CharacterIterator
Encapsulates char[] as CharacterIterator
author
Ales Novak
version
CVS $Id: CharacterArrayCharacterIterator.java,v 1.1.2.1 2005/08/01 00:02:57 jeffsuttor Exp $

Fields Summary
private final char[]
src
encapsulated
private final int
off
offset in the char array
private final int
len
used portion of the array
Constructors Summary
public CharacterArrayCharacterIterator(char[] src, int off, int len)

param
src - encapsulated String

        this.src = src;
        this.off = off;
        this.len = len;
    
Methods Summary
public charcharAt(int pos)

return
a character at the specified position.

        return src[off + pos];
    
public booleanisEnd(int pos)

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

        return (pos >= len);
    
public java.lang.Stringsubstring(int beginIndex, int endIndex)

return
a substring

        if (endIndex > len) {
            throw new IndexOutOfBoundsException("endIndex=" + endIndex
                                                + "; sequence size=" + len);
        }
        if (beginIndex < 0 || beginIndex > endIndex) {
            throw new IndexOutOfBoundsException("beginIndex=" + beginIndex
                                                + "; endIndex=" + endIndex);
        }
        return new String(src, off + beginIndex, endIndex - beginIndex);
    
public java.lang.Stringsubstring(int beginIndex)

return
a substring

        return substring(beginIndex, len);