|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.util.ChunkedString
public class ChunkedString
This class allow to process substrings of a bigger string without allocate additional memory, but using the original buffer. The original string is not modified by this class.
Constructor Summary | |
---|---|
ChunkedString(ChunkedString cs)
Creates a ChunkedString from another ChunkedString and two indexes relative to the chunk |
|
ChunkedString(ChunkedString cs,
int a,
int b)
Creates a ChunkedString from another ChunkedString and two indexes relative to the chunk |
|
ChunkedString(java.lang.String s)
Creates a ChunkedString from a plain String, with length equal to the whole string. |
|
ChunkedString(java.lang.String s,
int a,
int b)
Creates a ChunkedString from a plain String and two indexes |
Method Summary | |
---|---|
char |
charAt(int index)
Returns the character at the specified position, relative to the chunk. |
boolean |
equals(java.lang.String s)
Returns true if s is equals to the current chunk |
boolean |
equalsIgnoreCase(java.lang.String s)
Returns true if s is equals to the current chunk, ignoring case. |
ChunkedString |
getNextChunk(java.lang.String sep)
Gets the next chunk, using the given separator, as another ChunkedString, without allocating memory. |
ChunkedString |
getNextChunk(java.lang.String[] sep)
Gets the smallest chunk, using one of the given separators, as a ChunkedString. |
java.lang.String |
getNextString(java.lang.String sep)
Gets the next chunk, using the given separator, as a plain String. |
java.lang.String |
getNextString(java.lang.String[] sep)
Gets the smallest chunk, using one of the given separators, as a plain String. |
int |
indexOf(ChunkedString s)
Returns the index within this chunk of the first occurrence of the specified substring. |
int |
indexOf(java.lang.String s)
Returns the index within this chunk of the first occurrence of the specified substring. |
int |
indexOf(java.lang.String s,
int newStartPoint)
Returns the index within this chunk of the first occurrence of the specified substring. |
boolean |
isEmpty()
Returns true if the chunk is empty (i.e. |
int |
length()
Returns the length of the substring. |
boolean |
moveEnd(int n)
Move the backward the end index of 'n' characters. |
boolean |
moveStart(int n)
Move the forward start index of 'n' characters. |
void |
reset()
Reset the chunk indexes to the lenght of the whole buffer. |
ChunkedString[] |
split(java.lang.String sep)
Split the string into an array of strings using one of the separator in 'sep'. |
boolean |
startsWith(java.lang.String s)
Returns true if the chunk is starts with the specified substring. |
ChunkedString |
substring(int newStart)
Creates a new ChunkedString from the specified indexes. |
ChunkedString |
substring(int newStart,
int newEnd)
Creates a new ChunkedString from the specified indexes. |
java.lang.String |
toString()
Return a copy of the string limited by the chunk indexes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ChunkedString(java.lang.String s)
s
- the stringpublic ChunkedString(java.lang.String s, int a, int b) throws java.lang.IndexOutOfBoundsException
s
- the stringa
- the start indexb
- the end index
java.lang.IndexOutOfBoundsException
public ChunkedString(ChunkedString cs, int a, int b)
cs
- the stringa
- the start indexb
- the end indexpublic ChunkedString(ChunkedString cs)
cs
- the stringa
- the start indexb
- the end indexMethod Detail |
---|
public java.lang.String getNextString(java.lang.String sep)
public java.lang.String getNextString(java.lang.String[] sep)
sep
- an array of string used as separators.
if two or more strings are found at the same index
the first one in the array is used as the separatorpublic ChunkedString getNextChunk(java.lang.String[] sep)
sep
- an array of string used as separators.
if two or more strings are found at the same index
the first one in the array is used as the separatorpublic ChunkedString getNextChunk(java.lang.String sep)
public char charAt(int index) throws java.lang.IndexOutOfBoundsException
index
- the index of the character relatoive to the chunk.
IndexOutOfBoundException
- If the given index is out of the chunk boundaries.
java.lang.IndexOutOfBoundsException
public ChunkedString[] split(java.lang.String sep)
s
- the string to tokenizesep
- a list of separator to use
public boolean equals(java.lang.String s)
public boolean equalsIgnoreCase(java.lang.String s)
public boolean isEmpty()
public int indexOf(java.lang.String s)
public int indexOf(java.lang.String s, int newStartPoint)
public int indexOf(ChunkedString s)
public ChunkedString substring(int newStart, int newEnd)
public ChunkedString substring(int newStart)
public int length()
public boolean startsWith(java.lang.String s)
public void reset()
public boolean moveStart(int n)
n
- the number of characters to move the index. If n is negative
start is moved backward.
true
if the start index is still valid after the move
false
if a boundary has been reached
(start was < 0 if for n negative, or greater than end
for n positive). In the this case, start is made equal
to the boundary.
public boolean moveEnd(int n)
n
- the number of characters to move the index
true
if the end index is still valid after the move
false
if a boundary has been reached
(end was less than start if for n positive, or greater than
buffer length for n positive). In this case, end is made equal
to the boundary.
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |