public final class CharChunk extends Object implements Cloneable, Serializable, 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(String s)
Append a string to the buffer.
|
void |
append(String s,
int off,
int len)
Append a string to the buffer.
|
char |
charAt(int index) |
boolean |
endsWith(String s) |
boolean |
equals(char[] b2,
int off2,
int len2) |
boolean |
equals(CharChunk cc) |
boolean |
equals(Object obj) |
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() |
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(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(String s) |
boolean |
startsWithIgnoreCase(String s,
int pos) |
CharSequence |
subSequence(int start,
int end) |
int |
substract() |
int |
substract(char[] dest,
int off,
int len) |
String |
toString() |
String |
toStringInternal() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
chars, codePoints
public CharChunk()
public CharChunk(int size)
public 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 IOException
IOException
public void append(CharChunk src) throws IOException
IOException
public void append(char[] src, int off, int len) throws IOException
src
- Char arrayoff
- Offsetlen
- LengthIOException
- Writing overflow data to the output channel failedpublic void append(String s) throws IOException
s
- The stringIOException
- Writing overflow data to the output channel failedpublic void append(String s, int off, int len) throws IOException
s
- The stringoff
- Offsetlen
- LengthIOException
- Writing overflow data to the output channel failedpublic int substract() throws IOException
IOException
public int substract(char[] dest, int off, int len) throws IOException
IOException
public void flushBuffer() throws IOException
IOException
public void makeSpace(int count)
count
- The sizepublic String toString()
toString
in interface CharSequence
toString
in class Object
public String toStringInternal()
public boolean equals(String s)
s
- the String to comparetrue
if the comparison succeeded, false
otherwisepublic boolean equalsIgnoreCase(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(String s)
s
- The stringtrue
if the message bytes starts with the specified string.public boolean startsWithIgnoreCase(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(String s)
s
- The stringtrue
if the message bytes end with the specified string.public 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(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
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.