|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.util.buf.ByteChunk
This class is used to represent a chunk of bytes, and utilities to manipulate byte[]. The buffer can be modified and used for both input and output.
Nested Class Summary | |
static interface |
ByteChunk.ByteInputChannel
|
static interface |
ByteChunk.ByteOutputChannel
|
Field Summary | |
static java.lang.String |
DEFAULT_CHARACTER_ENCODING
Default encoding used to convert to strings. |
Constructor Summary | |
ByteChunk()
Creates a new, uninitialized ByteChunk object. |
|
ByteChunk(int initial)
|
Method Summary | |
void |
allocate(int initial,
int limit)
|
void |
append(byte b)
|
void |
append(byte[] src,
int off,
int len)
Add data to the buffer |
void |
append(ByteChunk src)
|
void |
append(char c)
|
boolean |
equals(byte[] b2,
int off2,
int len2)
|
boolean |
equals(ByteChunk bb)
|
boolean |
equals(char[] c2,
int off2,
int len2)
|
boolean |
equals(CharChunk cc)
|
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. |
static int |
findChar(byte[] buf,
int start,
int end,
char c)
Find a character, no side effects. |
static int |
findChars(byte[] buf,
int start,
int end,
byte[] c)
Find a character, no side effects. |
static int |
findNotChars(byte[] buf,
int start,
int end,
byte[] c)
Find the first character ! |
void |
flushBuffer()
|
byte[] |
getBuffer()
Returns the message bytes. |
byte[] |
getBytes()
Returns the message bytes. |
ByteChunk |
getClone()
|
int |
getEnd()
|
int |
getInt()
|
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()
|
static int |
indexOf(byte[] bytes,
int off,
int end,
char qq)
|
int |
indexOf(char c,
int starting)
Returns true if the message bytes starts with the specified string. |
int |
indexOf(java.lang.String src,
int srcOff,
int srcLen,
int myOff)
|
boolean |
isNull()
|
void |
recycle()
Resets the message buff to an uninitialized state. |
void |
reset()
|
void |
setByteInputChannel(ByteChunk.ByteInputChannel in)
When the buffer is empty, read the data from the input channel. |
void |
setByteOutputChannel(ByteChunk.ByteOutputChannel out)
When the buffer is full, write the data to the output channel. |
void |
setBytes(byte[] b,
int off,
int len)
Sets the message bytes to the specified subarray of bytes. |
void |
setEncoding(java.lang.String enc)
|
void |
setEnd(int i)
|
void |
setLimit(int limit)
Maximum amount of data in this buffer. |
void |
setOffset(int off)
|
boolean |
startsWith(byte[] b2)
|
boolean |
startsWith(java.lang.String s)
Returns true if the message bytes starts with the specified string. |
boolean |
startsWithIgnoreCase(java.lang.String s,
int pos)
Returns true if the message bytes starts with the specified string. |
int |
substract()
|
int |
substract(byte[] src,
int off,
int len)
|
int |
substract(ByteChunk src)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_CHARACTER_ENCODING
Constructor Detail |
public ByteChunk()
public ByteChunk(int initial)
Method Detail |
public ByteChunk getClone()
public boolean isNull()
public void recycle()
public void reset()
public void allocate(int initial, int limit)
public void setBytes(byte[] b, int off, int len)
b
- the ascii bytesoff
- the start offset of the byteslen
- the length of the bytespublic void setEncoding(java.lang.String enc)
public byte[] getBytes()
public byte[] getBuffer()
public int getStart()
public int getOffset()
public void setOffset(int off)
public int getLength()
public void setLimit(int limit)
public int getLimit()
public void setByteInputChannel(ByteChunk.ByteInputChannel in)
public void setByteOutputChannel(ByteChunk.ByteOutputChannel out)
public int getEnd()
public void setEnd(int i)
public void append(char c) throws java.io.IOException
java.io.IOException
public void append(byte b) throws java.io.IOException
java.io.IOException
public void append(ByteChunk src) throws java.io.IOException
java.io.IOException
public void append(byte[] src, int off, int len) throws java.io.IOException
java.io.IOException
public int substract() throws java.io.IOException
java.io.IOException
public int substract(ByteChunk src) throws java.io.IOException
java.io.IOException
public int substract(byte[] src, int off, int len) throws java.io.IOException
java.io.IOException
public void flushBuffer() throws java.io.IOException
java.io.IOException
public java.lang.String toString()
public int getInt()
public boolean equals(java.lang.String s)
s
- the String to compare
public boolean equalsIgnoreCase(java.lang.String s)
s
- the String to compare
public boolean equals(ByteChunk bb)
public boolean equals(byte[] b2, int off2, int len2)
public boolean equals(CharChunk cc)
public boolean equals(char[] c2, int off2, int len2)
public boolean startsWith(java.lang.String s)
s
- the stringpublic boolean startsWith(byte[] b2)
public boolean startsWithIgnoreCase(java.lang.String s, int pos)
s
- the stringpublic int indexOf(java.lang.String src, int srcOff, int srcLen, int myOff)
public int hash()
public int hashIgnoreCase()
public int indexOf(char c, int starting)
public static int indexOf(byte[] bytes, int off, int end, char qq)
public static int findChar(byte[] buf, int start, int end, char c)
public static int findChars(byte[] buf, int start, int end, byte[] c)
public static int findNotChars(byte[] buf, int start, int end, byte[] c)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |