GXPARSE hosted by SourceForge.net Logo

ca.gorman.xml.parse.toolkit
Class AbstractCharSequence

java.lang.Object
  extended by ca.gorman.xml.parse.toolkit.AbstractCharSequence
All Implemented Interfaces:
CharSequence

public class AbstractCharSequence
extends Object
implements CharSequence

Character source for Listener methods that receive character input from the Parser.

Warning: AbstractCharSequence may only hold a reference to data instead of a copy of the data. Change of the data after creation of an instance of AbstractCharSequence may invalidate the instance or cause one of the instance methods to throw an exception.

This class is implemented for safety and ease of debugging, rather than for speed. It can be subclassed or replaced if speed is more important.


Method Summary
 char charAt(int n)
           
 int length()
           
static AbstractCharSequence newInstance(char[] chr)
           Construct CharSequence on an array of characters.
static AbstractCharSequence newInstance(char[] chr, int offset, int length)
           Construct CharSequence on a subarray of characters.
static AbstractCharSequence newInstance(CharSequence charSequence)
           Construct CharSequence on another charSequence.
 CharSequence subSequence(int start, int end)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newInstance

public static AbstractCharSequence newInstance(char[] chr,
                                               int offset,
                                               int length)

Construct CharSequence on a subarray of characters.

Throws:
NullPointerException - if charSequence is null.

newInstance

public static AbstractCharSequence newInstance(char[] chr)

Construct CharSequence on an array of characters.

Throws:
NullPointerException - if charSequence is null.

newInstance

public static AbstractCharSequence newInstance(CharSequence charSequence)

Construct CharSequence on another charSequence.

This simply adds another level of indirection (by delegation) which may be useful when there is a possibility of future changes in the way that a CharSequence is to be created.

Throws:
NullPointerException - if charSequence is null.

charAt

public char charAt(int n)
Specified by:
charAt in interface CharSequence

length

public int length()
Specified by:
length in interface CharSequence

toString

public String toString()
Specified by:
toString in interface CharSequence
Overrides:
toString in class Object

subSequence

public CharSequence subSequence(int start,
                                int end)
Specified by:
subSequence in interface CharSequence

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License