|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.util.buf.CharChunk
public final class CharChunk
Utilities to manipulate char chunks. While String is the easiest way to manipulate chars ( search, substrings, etc), it is known to not be the most efficient solution - Strings are designed as immutable and secure objects.
Nested Class Summary | |
---|---|
static interface |
CharChunk.CharInputChannel
|
static interface |
CharChunk.CharOutputChannel
When we need more space we'll either grow the buffer ( up to the limit ) or send it to a channel. |
Constructor Summary | |
---|---|
CharChunk()
Creates a new, uninitialized CharChunk object. |
|
CharChunk(int size)
|
Method Summary | |
---|---|
void |
allocate(int initial,
int limit)
|
void |
append(char b)
|
void |
append(char[] src,
int off,
int len)
Add data to the buffer |
void |
append(CharChunk src)
|
void |
append(String s)
Append a string to the buffer |
void |
append(StringBuilder sb)
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
void |
append(String s,
int off,
int len)
Append a string to the buffer |
char |
charAt(int index)
|
boolean |
endsWith(String s)
Returns true if the message bytes end with the specified string. |
boolean |
equals(byte[] b2,
int off2,
int len2)
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
boolean |
equals(char[] b2,
int off2,
int len2)
|
boolean |
equals(CharChunk cc)
|
boolean |
equals(String s)
Compares the message bytes to the specified String object. |
boolean |
equalsIgnoreCase(String s)
Compares the message bytes to the specified String object. |
void |
flushBuffer()
|
char[] |
getBuffer()
|
char[] |
getChars()
|
CharChunk |
getClone()
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
int |
getEnd()
|
int |
getInt()
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
int |
getLength()
Returns the length of the bytes. |
int |
getLimit()
|
int |
getOffset()
|
int |
getStart()
Returns the start offset of the bytes. |
int |
hash()
|
int |
hashIgnoreCase()
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
int |
indexOf(char c)
|
static int |
indexOf(char[] chars,
int off,
int cend,
char qq)
|
int |
indexOf(char c,
int starting)
Returns true if the message bytes starts with the specified string. |
int |
indexOf(String src,
int srcOff,
int srcLen,
int myOff)
|
boolean |
isNull()
|
int |
length()
|
void |
recycle()
Resets the message bytes to an uninitialized state. |
void |
reset()
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
void |
setCharInputChannel(CharChunk.CharInputChannel in)
When the buffer is empty, read the data from the input channel. |
void |
setCharOutputChannel(CharChunk.CharOutputChannel out)
When the buffer is full, write the data to the output channel. |
void |
setChars(char[] c,
int off,
int len)
|
void |
setEnd(int i)
|
void |
setLimit(int limit)
Maximum amount of data in this buffer. |
void |
setOffset(int off)
Returns the start offset of the bytes. |
void |
setOptimizedWrite(boolean optimizedWrite)
|
boolean |
startsWith(String s)
Returns true if the message bytes starts with the specified string. |
boolean |
startsWithIgnoreCase(String s,
int pos)
Returns true if the message bytes starts with the specified string. |
CharSequence |
subSequence(int start,
int end)
|
int |
substract()
|
int |
substract(char[] src,
int off,
int len)
|
int |
substract(CharChunk src)
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
String |
toString()
|
String |
toStringInternal()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CharChunk()
public CharChunk(int size)
Method Detail |
---|
@Deprecated public CharChunk getClone()
public boolean isNull()
public void recycle()
@Deprecated public void reset()
public void allocate(int initial, int limit)
public void setOptimizedWrite(boolean optimizedWrite)
public void setChars(char[] c, int off, int len)
public void setLimit(int limit)
public int getLimit()
public void setCharInputChannel(CharChunk.CharInputChannel in)
public void setCharOutputChannel(CharChunk.CharOutputChannel out)
public char[] getChars()
public char[] getBuffer()
public int getStart()
public int getOffset()
public void setOffset(int off)
public int getLength()
public int getEnd()
public void setEnd(int i)
public void append(char b) throws IOException
IOException
public void append(CharChunk src) throws IOException
IOException
public void append(char[] src, int off, int len) throws IOException
IOException
@Deprecated public void append(StringBuilder sb) throws IOException
IOException
public void append(String s) throws IOException
IOException
public void append(String s, int off, int len) throws IOException
IOException
public int substract() throws IOException
IOException
@Deprecated public int substract(CharChunk src) throws IOException
IOException
public int substract(char[] src, int off, int len) throws IOException
IOException
public void flushBuffer() throws IOException
IOException
public String toString()
toString
in interface CharSequence
toString
in class Object
public String toStringInternal()
@Deprecated public int getInt()
public boolean equals(String s)
s
- the String to compare
public boolean equalsIgnoreCase(String s)
s
- the String to compare
public boolean equals(CharChunk cc)
public boolean equals(char[] b2, int off2, int len2)
@Deprecated public boolean equals(byte[] b2, int off2, int len2)
public boolean startsWith(String s)
s
- the stringpublic boolean startsWithIgnoreCase(String s, int pos)
s
- the stringpublic boolean endsWith(String s)
s
- the stringpublic int hash()
@Deprecated public int hashIgnoreCase()
public int indexOf(char c)
public int indexOf(char c, int starting)
c
- the characterpublic static int indexOf(char[] chars, int off, int cend, char qq)
public int indexOf(String src, int srcOff, int srcLen, int myOff)
public char charAt(int index)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public int length()
length
in interface CharSequence
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |