public class CharSegment
extends java.lang.Object
implements java.lang.CharSequence
Modifier and Type | Field and Description |
---|---|
protected char[] |
_buffer |
protected int |
_length |
protected int |
_offset |
Constructor and Description |
---|
CharSegment() |
CharSegment(char[] buffer,
int offset,
int length)
Constructs a char segment based on a char array.
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int i)
Returns the char at the specified offset.
|
boolean |
endsWith(CharSegment cb)
Returns true if the CharSegment ends with the char segment.
|
boolean |
endsWith(java.lang.String string)
Returns true if the CharSegment ends with the string.
|
boolean |
equals(char[] cb,
int length)
Returns true if the CharSegment equals the char array.
|
boolean |
equals(char[] cb,
int offset,
int length)
Returns true if the CharSegment equals the char array.
|
boolean |
equals(CharSegment cb)
Returns true if the two char segments are equal.
|
boolean |
equals(java.lang.Object a) |
boolean |
equalsIgnoreCase(CharSegment b)
Returns true if the two CharSegments are equivalent ignoring the case.
|
boolean |
equalsIgnoreCase(java.lang.String a)
Returns true if the CharSegment equals the string.
|
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 |
getOffset() |
int |
hashCode()
Returns the buffer's hash code
|
int |
indexOf(char ch)
Returns the index of a character in the CharSegment.
|
int |
indexOf(char ch,
int start)
Returns the index of a character in the CharSegment starting
from an offset.
|
int |
indexOf(java.lang.String s) |
int |
indexOf(java.lang.String s,
int start) |
void |
init(char[] buffer,
int offset,
int length)
Sets the char segment to a new buffer triple.
|
int |
lastIndexOf(char ch)
Returns the last index of a character in the CharSegment.
|
int |
lastIndexOf(char ch,
int start)
Returns the last index of a character in the CharSegment starting
from an offset.
|
int |
length()
Returns the character count of the buffer's contents.
|
boolean |
matches(java.lang.Object a) |
boolean |
matches(java.lang.String sa)
Returns true if the charSegment matches the string.
|
boolean |
matchesIgnoreCase(java.lang.String sa)
Returns true if the CharSegment matches the string, ignoring the case.
|
boolean |
regionMatches(int off1,
CharSegment buf,
int off2,
int len) |
boolean |
regionMatches(int off1,
java.lang.String buf,
int off2,
int len) |
boolean |
regionMatchesIgnoreCase(int off1,
CharSegment buf,
int off2,
int len) |
boolean |
startsWith(java.lang.String string)
Returns true if the CharSegment starts with the string.
|
java.lang.CharSequence |
subSequence(int start,
int end)
Returns a subsequence
|
java.lang.String |
substring(int start)
Returns a substring
|
java.lang.String |
substring(int start,
int end)
Returns a substring
|
CharSegment |
toLowerCase()
Converts the contents of the segment to lower case.
|
java.lang.String |
toString()
String representation of the buffer.
|
protected char[] _buffer
protected int _offset
protected int _length
public CharSegment()
public CharSegment(char[] buffer, int offset, int length)
public void init(char[] buffer, int offset, int length)
public final int length()
length
in interface java.lang.CharSequence
public final int getLength()
public final int getOffset()
public char charAt(int i)
charAt
in interface java.lang.CharSequence
public char getLastChar()
java.lang.IndexOutOfBoundsException
- for an empty bufferpublic char[] getBuffer()
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
public java.lang.String substring(int start)
public java.lang.String substring(int start, int end)
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public int indexOf(char ch)
public final int indexOf(char ch, int start)
public final int lastIndexOf(char ch)
public final int lastIndexOf(char ch, int start)
public int indexOf(java.lang.String s)
public int indexOf(java.lang.String s, int start)
public int hashCode()
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object a)
equals
in class java.lang.Object
public boolean equals(CharSegment cb)
public final boolean equals(char[] cb, int length)
public final boolean equals(char[] cb, int offset, int length)
public final boolean equalsIgnoreCase(java.lang.String a)
public final boolean equalsIgnoreCase(CharSegment b)
public final boolean matches(java.lang.Object a)
public boolean matches(java.lang.String sa)
public boolean matchesIgnoreCase(java.lang.String sa)
public boolean regionMatches(int off1, CharSegment buf, int off2, int len)
public boolean regionMatches(int off1, java.lang.String buf, int off2, int len)
public boolean regionMatchesIgnoreCase(int off1, CharSegment buf, int off2, int len)
public boolean startsWith(java.lang.String string)
public boolean endsWith(java.lang.String string)
public boolean endsWith(CharSegment cb)
public CharSegment toLowerCase()
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object