public final class CharChunk
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, java.lang.CharSequence
| Modifier and Type | Class and Description |
|---|---|
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 and Description |
|---|
CharChunk()
Creates a new, uninitialized CharChunk object.
|
CharChunk(int size) |
| Modifier and Type | Method and Description |
|---|---|
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(java.lang.String s)
Append a string to the buffer.
|
void |
append(java.lang.String s,
int off,
int len)
Append a string to the buffer.
|
char |
charAt(int index) |
java.lang.Object |
clone() |
boolean |
endsWith(java.lang.String s) |
boolean |
equals(char[] b2,
int off2,
int len2) |
boolean |
equals(CharChunk cc) |
boolean |
equals(java.lang.Object obj) |
boolean |
equals(java.lang.String s)
Compares the message bytes to the specified String object.
|
boolean |
equalsIgnoreCase(java.lang.String s)
Compares the message bytes to the specified String object.
|
void |
flushBuffer() |
char[] |
getBuffer() |
char[] |
getChars() |
int |
getEnd() |
int |
getLength() |
int |
getLimit() |
int |
getOffset() |
int |
getStart() |
int |
hash() |
int |
hashCode() |
int |
indexOf(char c) |
static int |
indexOf(char[] chars,
int off,
int cend,
char qq) |
int |
indexOf(char c,
int starting) |
int |
indexOf(java.lang.String src,
int srcOff,
int srcLen,
int myOff) |
boolean |
isNull() |
int |
length() |
void |
makeSpace(int count)
Make space for len chars.
|
void |
recycle()
Resets the message bytes to an uninitialized state.
|
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) |
void |
setOptimizedWrite(boolean optimizedWrite) |
boolean |
startsWith(java.lang.String s) |
boolean |
startsWithIgnoreCase(java.lang.String s,
int pos) |
java.lang.CharSequence |
subSequence(int start,
int end) |
int |
substract() |
int |
substract(char[] dest,
int off,
int len) |
java.lang.String |
toString() |
java.lang.String |
toStringInternal() |
public CharChunk()
public CharChunk(int size)
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic boolean isNull()
public void recycle()
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)
limit - The new limitpublic int getLimit()
public void setCharInputChannel(CharChunk.CharInputChannel in)
in - The input channelpublic void setCharOutputChannel(CharChunk.CharOutputChannel out)
out - The output channelpublic char[] getChars()
public char[] getBuffer()
public int getStart()
public int getOffset()
public void setOffset(int off)
off - The offsetpublic int getLength()
public int getEnd()
public void setEnd(int i)
public void append(char b)
throws java.io.IOException
java.io.IOExceptionpublic void append(CharChunk src) throws java.io.IOException
java.io.IOExceptionpublic void append(char[] src,
int off,
int len)
throws java.io.IOException
src - Char arrayoff - Offsetlen - Lengthjava.io.IOException - Writing overflow data to the output channel failedpublic void append(java.lang.String s)
throws java.io.IOException
s - The stringjava.io.IOException - Writing overflow data to the output channel failedpublic void append(java.lang.String s,
int off,
int len)
throws java.io.IOException
s - The stringoff - Offsetlen - Lengthjava.io.IOException - Writing overflow data to the output channel failedpublic int substract()
throws java.io.IOException
java.io.IOExceptionpublic int substract(char[] dest,
int off,
int len)
throws java.io.IOException
java.io.IOExceptionpublic void flushBuffer()
throws java.io.IOException
java.io.IOExceptionpublic void makeSpace(int count)
count - The sizepublic java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic java.lang.String toStringInternal()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic boolean equals(java.lang.String s)
s - the String to comparetrue if the comparison succeeded, false otherwisepublic boolean equalsIgnoreCase(java.lang.String s)
s - the String to comparetrue if the comparison succeeded, false otherwisepublic boolean equals(CharChunk cc)
public boolean equals(char[] b2,
int off2,
int len2)
public boolean startsWith(java.lang.String s)
s - The stringtrue if the message bytes starts with the specified string.public boolean startsWithIgnoreCase(java.lang.String s,
int pos)
s - The stringpos - The position at which the comparison will be madetrue if the message bytes starts with the specified string.public boolean endsWith(java.lang.String s)
s - The stringtrue if the message bytes end with the specified string.public int hashCode()
hashCode in class java.lang.Objectpublic int hash()
public int indexOf(char c)
public int indexOf(char c,
int starting)
c - the characterstarting - Start positiontrue if the message bytes starts with the specified string.public static int indexOf(char[] chars,
int off,
int cend,
char qq)
public int indexOf(java.lang.String src,
int srcOff,
int srcLen,
int myOff)
public char charAt(int index)
charAt in interface java.lang.CharSequencepublic java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequencepublic int length()
length in interface java.lang.CharSequenceCopyright © 2000-2018 Apache Software Foundation. All Rights Reserved.