public final class CharChunk extends Object implements Chunk, Cloneable, Serializable
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.
|
Modifier and Type | Field and Description |
---|---|
static Charset |
DEFAULT_HTTP_CHARSET
Default encoding used to convert to strings.
|
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(StringBuffer sb)
Add data to the buffer
|
void |
append(String s,
int off,
int len)
Append a string to the buffer
|
void |
delete(int start,
int end) |
boolean |
endsWith(String s) |
void |
ensureCapacity(int size) |
boolean |
equals(byte[] b)
Compares the message bytes to the specified byte array representing
ASCII characters.
|
boolean |
equals(byte[] b2,
int off2,
int len2) |
boolean |
equals(char[] b2,
int off2,
int len2) |
boolean |
equals(CharChunk cc) |
boolean |
equals(CharSequence s)
Compares the message bytes to the specified String object.
|
boolean |
equals(Object o) |
boolean |
equalsIgnoreCase(byte[] b)
Compares the message bytes to the specified byte array representing
ASCII characters.
|
boolean |
equalsIgnoreCase(byte[] b,
int offset,
int len)
Compares the message bytes to the specified byte array representing
ASCII characters.
|
boolean |
equalsIgnoreCase(char[] b,
int offset,
int len)
Compares the message bytes to the specified char array representing
ASCII characters.
|
boolean |
equalsIgnoreCase(CharSequence s)
Compares the message bytes to the specified String object.
|
boolean |
equalsIgnoreCaseLowerCase(byte[] b)
Compares the char chunk to the specified byte array representing
lower-case ASCII characters.
|
void |
flushBuffer() |
char[] |
getBuffer() |
char[] |
getChars() |
CharChunk |
getClone() |
int |
getEnd() |
int |
getInt() |
int |
getLength()
Returns the length of the bytes.
|
int |
getLimit() |
int |
getStart()
Returns the start offset of the bytes.
|
int |
hash() |
int |
hashCode() |
int |
hashIgnoreCase() |
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 s,
int fromIndex) |
int |
indexOf(String src,
int srcOff,
int srcLen,
int myOff) |
boolean |
isNull() |
protected void |
notifyDirectUpdate()
Notify the Chunk that its content is going to be changed directly
|
void |
recycle()
Resets the message bytes to an uninitialized state.
|
void |
reset() |
protected void |
resetStringCache() |
void |
set(BufferChunk bufferChunk,
Charset encoding)
Set
BufferChunk content to CharChunk using given Charset . |
void |
set(ByteChunk byteChunk,
Charset encoding)
|
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 |
setOptimizedWrite(boolean optimizedWrite) |
void |
setStart(int start)
Returns the start offset of the bytes.
|
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.
|
int |
substract() |
int |
substract(char[] src,
int off,
int len) |
int |
substract(CharChunk src) |
String |
toString() |
String |
toString(int start,
int end) |
String |
toStringInternal() |
public static final Charset DEFAULT_HTTP_CHARSET
public CharChunk()
public CharChunk(int size)
public CharChunk getClone()
public boolean isNull()
public void recycle()
public void reset()
public void allocate(int initial, int limit)
public void ensureCapacity(int size)
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 void setStart(int start)
public int getLength()
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
public void append(StringBuffer 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
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
protected void notifyDirectUpdate()
protected final void resetStringCache()
public String toStringInternal()
public int getInt()
public void set(ByteChunk byteChunk, Charset encoding) throws CharConversionException
Exception
CharConversionException
public void set(BufferChunk bufferChunk, Charset encoding) throws CharConversionException
BufferChunk
content to CharChunk using given Charset
.Exception
CharConversionException
public boolean equals(CharSequence s)
s
- the String to comparepublic boolean equals(byte[] b)
b
- the byte[]
to comparepublic boolean equalsIgnoreCase(CharSequence s)
s
- the String to comparepublic boolean equalsIgnoreCase(byte[] b)
b
- the byte[]
to comparepublic boolean equalsIgnoreCase(byte[] b, int offset, int len)
b
- the byte[]
to comparepublic boolean equalsIgnoreCase(char[] b, int offset, int len)
b
- the char[]
to comparepublic boolean equalsIgnoreCaseLowerCase(byte[] b)
b
- the byte[]
to comparepublic boolean equals(CharChunk cc)
public boolean equals(char[] b2, int off2, int len2)
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)
public int hash()
public int hashIgnoreCase()
public int indexOf(char c)
public int indexOf(char c, int starting)
public static int indexOf(char[] chars, int off, int cend, char qq)
public final int indexOf(String src, int srcOff, int srcLen, int myOff)
Copyright © 2015 Oracle Corporation. All rights reserved.