public final class CharChunk extends AbstractChunk implements CharSequence
Modifier and Type | Class and Description |
---|---|
static interface |
CharChunk.CharInputChannel
Input interface, used when the buffer is empty.
|
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.
|
ARRAY_MAX_SIZE, end, hasHashCode, isSet, start
Constructor and Description |
---|
CharChunk()
Creates a new, uninitialized CharChunk object.
|
CharChunk(int initial) |
Modifier and Type | Method and Description |
---|---|
void |
allocate(int initial,
int limit) |
void |
append(char c) |
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) |
Object |
clone() |
boolean |
endsWith(String s) |
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(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()
Send the buffer to the sink.
|
char[] |
getBuffer() |
protected int |
getBufferElement(int index) |
char[] |
getChars() |
CharChunk |
getClone()
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
int |
getInt()
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
int |
hashIgnoreCase()
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
int |
indexOf(char c) |
static int |
indexOf(char[] chars,
int start,
int end,
char s)
Returns the first instance of the given character in the given char array
between the specified start and end.
|
int |
indexOf(char c,
int starting)
Returns the first instance of the given character in this CharChunk
starting at the specified char.
|
int |
length() |
void |
makeSpace(int count)
Make space for len chars.
|
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)
Sets the buffer to the specified subarray of characters.
|
void |
setOptimizedWrite(boolean optimizedWrite) |
boolean |
startsWith(String s) |
boolean |
startsWithIgnoreCase(String s,
int pos)
Returns true if the buffer starts with the specified string.
|
CharSequence |
subSequence(int start,
int end) |
int |
substract() |
int |
substract(char[] dest,
int off,
int len) |
int |
substract(CharChunk src)
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
String |
toString() |
String |
toStringInternal() |
public CharChunk()
public CharChunk(int initial)
@Deprecated public CharChunk getClone()
clone()
@Deprecated public void reset()
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void allocate(int initial, int limit)
public void setOptimizedWrite(boolean optimizedWrite)
public void setChars(char[] c, int off, int len)
c
- the charactersoff
- the start offset of the characterslen
- the length of the characterspublic char[] getChars()
public char[] getBuffer()
public void setCharInputChannel(CharChunk.CharInputChannel in)
in
- The input channelpublic void setCharOutputChannel(CharChunk.CharOutputChannel out)
out
- The output channelpublic void append(char c) 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 failed@Deprecated public void append(StringBuilder sb) throws IOException
sb
- The string builderIOException
- 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
@Deprecated public int substract(CharChunk src) throws IOException
src
- Destination for subtracted dataIOException
- If an I/O error occurspublic int substract(char[] dest, int off, int len) throws IOException
IOException
public void flushBuffer() throws IOException
IOException
- Writing overflow data to the output channel failedpublic void makeSpace(int count)
AbstractChunk.ARRAY_MAX_SIZE
.count
- The sizepublic 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 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)
@Deprecated public boolean equals(byte[] b2, int off2, int len2)
b2
- Byte array to testoff2
- Offset for byte arraylen2
- Length of byte arraytrue
if the contents of the provided byte array are
equal to the contents of this objectpublic 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 positiontrue
if the start matchespublic boolean endsWith(String s)
s
- The stringtrue
if the message bytes end with the specified
string.protected int getBufferElement(int index)
getBufferElement
in class AbstractChunk
@Deprecated public int hashIgnoreCase()
public int indexOf(char c)
public int indexOf(char c, int starting)
c
- The characterstarting
- The start positionpublic static int indexOf(char[] chars, int start, int end, char s)
chars
- The array to searchstart
- The point to start searching from in the arrayend
- The point to stop searching in the arrays
- The character to search forpublic 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-2021 Apache Software Foundation. All Rights Reserved.