com.caucho.util
Class CharSegment

java.lang.Object
  |
  +--com.caucho.util.CharSegment

public final class CharSegment
extends java.lang.Object

CharSegment is a section of a character bufferk


Constructor Summary
CharSegment(char[] buffer, int offset, int length)
          Constructs a char buffer with no characters.
 
Method Summary
 char charAt(int i)
          Returns the char at the specified offset.
 boolean endsWith(java.lang.String string)
           
 boolean equals(java.lang.Object a)
           
 boolean equalsIgnoreCase(CharSegment cs)
           
 boolean equalsIgnoreCase(java.lang.String a)
           
 char[] getBuffer()
          Returns the buffer's char array.
 void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
          Copies characters to the destination buffer.
 char getLastChar()
          Returns the last character of the buffer
 int getLength()
          Returns the buffer length
 int hashCode()
          Returns the buffer's hash code
 int indexOf(char ch)
           
 int indexOf(char ch, int start)
           
 int lastIndexOf(char ch)
           
 int lastIndexOf(char ch, int start)
           
 int length()
          Returns the character count of the buffer's contents.
 boolean regionMatches(int off1, CharSegment buf, int off2, int len)
           
 boolean regionMatches(int off1, java.lang.String buf, int off2, int len)
           
 boolean startsWith(java.lang.String string)
           
 java.lang.String substring(int start)
          Returns a substring
 java.lang.String substring(int start, int end)
          Returns a substring
 void toLowerCase()
           
 java.lang.String toString()
          String representation of the buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CharSegment

public CharSegment(char[] buffer,
                   int offset,
                   int length)
Constructs a char buffer with no characters.
Method Detail

length

public int length()
Returns the character count of the buffer's contents.

getLength

public int getLength()
Returns the buffer length

charAt

public char charAt(int i)
Returns the char at the specified offset.

getLastChar

public char getLastChar()
Returns the last character of the buffer
Throws:
IndexOutOfBoundsException - for an empty buffer

getBuffer

public char[] getBuffer()
Returns the buffer's char array.

getChars

public void getChars(int srcBegin,
                     int srcEnd,
                     char[] dst,
                     int dstBegin)
Copies characters to the destination buffer.

substring

public java.lang.String substring(int start)
Returns a substring

substring

public java.lang.String substring(int start,
                                  int end)
Returns a substring

indexOf

public int indexOf(char ch,
                   int start)

indexOf

public int indexOf(char ch)

lastIndexOf

public int lastIndexOf(char ch,
                       int start)

lastIndexOf

public int lastIndexOf(char ch)

hashCode

public int hashCode()
Returns the buffer's hash code
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object a)
Overrides:
equals in class java.lang.Object

equalsIgnoreCase

public boolean equalsIgnoreCase(java.lang.String a)

equalsIgnoreCase

public boolean equalsIgnoreCase(CharSegment cs)

toLowerCase

public void toLowerCase()

regionMatches

public boolean regionMatches(int off1,
                             CharSegment buf,
                             int off2,
                             int len)

regionMatches

public boolean regionMatches(int off1,
                             java.lang.String buf,
                             int off2,
                             int len)

startsWith

public boolean startsWith(java.lang.String string)

endsWith

public boolean endsWith(java.lang.String string)

toString

public java.lang.String toString()
String representation of the buffer.
Overrides:
toString in class java.lang.Object