| java.lang.Object org.apache.tomcat.util.buf.ByteChunk
All known Subclasses: org.apache.coyote.tomcat4.OutputBuffer, org.apache.coyote.http11.InternalOutputBuffer,
ByteChunk | final public class ByteChunk implements Cloneable,Serializable(Code) | | 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.
author: dac@sun.com author: James Todd [gonzo@sun.com] author: Costin Manolache author: Remy Maucherat |
Inner Class :public static interface ByteInputChannel | |
Inner Class :public static interface ByteOutputChannel | |
Constructor Summary | |
public | ByteChunk() Creates a new, uninitialized ByteChunk object. | public | ByteChunk(int initial) |
Method Summary | |
public void | allocate(int initial, int limit) | public void | append(char c) | public void | append(byte b) | public void | append(ByteChunk src) | public void | append(byte src, int off, int len) | public boolean | equals(String s) Compares the message bytes to the specified String object. | 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 | equalsIgnoreCase(String s) Compares the message bytes to the specified String object. | public static int | findChar(byte buf, int start, int end, char c) Find a character, no side effects. | public static int | findChars(byte buf, int start, int end, byte c) Find a character, no side effects. | public static int | findNotChars(byte buf, int start, int end, byte c) | public void | flushBuffer() | public byte[] | getBuffer() Returns the message bytes. | public byte[] | getBytes() Returns the message bytes. | public ByteChunk | getClone() | public int | getEnd() | public int | getInt() | public int | getLength() Returns the length of the bytes. | public int | getLimit() | public long | getLong() | public int | getOffset() | public int | getStart() Returns the start offset of the bytes. | public int | hash() | public int | hashIgnoreCase() | public int | indexOf(String src, int srcOff, int srcLen, int myOff) | public int | indexOf(char c, int starting) Returns true if the message bytes starts with the specified string. | public static int | indexOf(byte bytes, int off, int end, char qq) | public boolean | isNull() | public void | recycle() Resets the message buff to an uninitialized state. | public void | reset() | public void | setByteInputChannel(ByteInputChannel in) When the buffer is empty, read the data from the input channel. | public void | setByteOutputChannel(ByteOutputChannel out) When the buffer is full, write the data to the output channel. | public void | setBytes(byte[] b, int off, int len) Sets the message bytes to the specified subarray of bytes. | public void | setEncoding(String enc) | public void | setEnd(int i) | public void | setLimit(int limit) Maximum amount of data in this buffer. | public void | setOffset(int off) | public void | setOptimizedWrite(boolean optimizedWrite) | public boolean | startsWith(String s) Returns true if the message bytes starts with the specified string. | public boolean | startsWith(byte[] b2) | public boolean | startsWithIgnoreCase(String s, int pos) Returns true if the message bytes starts with the specified string. | public int | substract() | public int | substract(ByteChunk src) | public int | substract(byte src, int off, int len) | public String | toString() |
DEFAULT_CHARACTER_ENCODING | final public static String DEFAULT_CHARACTER_ENCODING(Code) | | Default encoding used to convert to strings. It should be UTF8,
as most standards seem to converge, but the servlet API requires
8859_1, and this object is used mostly for servlets.
|
ByteChunk | public ByteChunk()(Code) | | Creates a new, uninitialized ByteChunk object.
|
ByteChunk | public ByteChunk(int initial)(Code) | | |
allocate | public void allocate(int initial, int limit)(Code) | | |
append | public void append(byte src, int off, int len) throws IOException(Code) | | Add data to the buffer
|
equals | public boolean equals(String s)(Code) | | Compares the message bytes to the specified String object.
Parameters: s - the String to compare true if the comparison succeeded, false otherwise |
equals | public boolean equals(byte b2, int off2, int len2)(Code) | | |
equals | public boolean equals(char c2, int off2, int len2)(Code) | | |
equalsIgnoreCase | public boolean equalsIgnoreCase(String s)(Code) | | Compares the message bytes to the specified String object.
Parameters: s - the String to compare true if the comparison succeeded, false otherwise |
findChar | public static int findChar(byte buf, int start, int end, char c)(Code) | | Find a character, no side effects.
|
findChars | public static int findChars(byte buf, int start, int end, byte c)(Code) | | Find a character, no side effects.
|
findNotChars | public static int findNotChars(byte buf, int start, int end, byte c)(Code) | | Find the first character != c
|
getBuffer | public byte[] getBuffer()(Code) | | Returns the message bytes.
|
getBytes | public byte[] getBytes()(Code) | | Returns the message bytes.
|
getEnd | public int getEnd()(Code) | | |
getInt | public int getInt()(Code) | | |
getLength | public int getLength()(Code) | | Returns the length of the bytes.
XXX need to clean this up
|
getLimit | public int getLimit()(Code) | | |
getLong | public long getLong()(Code) | | |
getOffset | public int getOffset()(Code) | | |
getStart | public int getStart()(Code) | | Returns the start offset of the bytes.
For output this is the end of the buffer.
|
hashIgnoreCase | public int hashIgnoreCase()(Code) | | |
indexOf | public int indexOf(String src, int srcOff, int srcLen, int myOff)(Code) | | |
indexOf | public int indexOf(char c, int starting)(Code) | | Returns true if the message bytes starts with the specified string.
Parameters: s - the string |
indexOf | public static int indexOf(byte bytes, int off, int end, char qq)(Code) | | |
isNull | public boolean isNull()(Code) | | |
recycle | public void recycle()(Code) | | Resets the message buff to an uninitialized state.
|
reset | public void reset()(Code) | | |
setByteInputChannel | public void setByteInputChannel(ByteInputChannel in)(Code) | | When the buffer is empty, read the data from the input channel.
|
setByteOutputChannel | public void setByteOutputChannel(ByteOutputChannel out)(Code) | | When the buffer is full, write the data to the output channel.
Also used when large amount of data is appended.
If not set, the buffer will grow to the limit.
|
setBytes | public void setBytes(byte[] b, int off, int len)(Code) | | Sets the message bytes to the specified subarray of bytes.
Parameters: b - the ascii bytes Parameters: off - the start offset of the bytes Parameters: len - the length of the bytes |
setEnd | public void setEnd(int i)(Code) | | |
setLimit | public void setLimit(int limit)(Code) | | Maximum amount of data in this buffer.
If -1 or not set, the buffer will grow undefinitely.
Can be smaller than the current buffer size ( which will not shrink ).
When the limit is reached, the buffer will be flushed ( if out is set )
or throw exception.
|
setOffset | public void setOffset(int off)(Code) | | |
setOptimizedWrite | public void setOptimizedWrite(boolean optimizedWrite)(Code) | | |
startsWith | public boolean startsWith(String s)(Code) | | Returns true if the message bytes starts with the specified string.
Parameters: s - the string |
startsWith | public boolean startsWith(byte[] b2)(Code) | | |
startsWithIgnoreCase | public boolean startsWithIgnoreCase(String s, int pos)(Code) | | Returns true if the message bytes starts with the specified string.
Parameters: s - the string |
|
|