| java.lang.Object com.nabhinc.util.md.CharChunk
CharChunk | final public class CharChunk implements Cloneable,Serializable,CharSequence(Code) | | Utilities to manipluate char chunks. While String is
the easiest way to manipulate chars ( search, substrings, etc),
it is known to not be the most efficient solution - Strings are
designed as imutable and secure objects.
author: dac@sun.com author: James Todd [gonzo@sun.com] author: Costin Manolache author: Remy Maucherat |
Inner Class :public static interface CharInputChannel | |
Inner Class :public static interface CharOutputChannel | |
Constructor Summary | |
public | CharChunk() Creates a new, uninitialized CharChunk object. | public | CharChunk(int size) |
Method Summary | |
public void | allocate(int initial, int limit) | public void | append(char b) | public void | append(CharChunk src) | public void | append(char src, int off, int len) | public void | append(StringBuffer sb) | public void | append(String s) | public void | append(String s, int off, int len) | public char | charAt(int index) | public boolean | equals(String s) Compares the message bytes to the specified String object. | public boolean | equals(CharChunk cc) | public boolean | equals(char b2, int off2, int len2) | public boolean | equals(byte b2, int off2, int len2) | public boolean | equalsIgnoreCase(String s) Compares the message bytes to the specified String object. | public void | flushBuffer() | public char[] | getBuffer() | public char[] | getChars() | public CharChunk | getClone() | public int | getEnd() | public int | getInt() | public int | getLength() Returns the length of the bytes. | public int | getLimit() | public int | getOffset() | public int | getStart() Returns the start offset of the bytes. | public int | hash() | public int | hashIgnoreCase() | public int | indexOf(char c) | public int | indexOf(char c, int starting) Returns true 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 boolean | isNull() | public int | length() | public void | recycle() Resets the message bytes to an uninitialized state. | public void | reset() | public void | setCharInputChannel(CharInputChannel in) When the buffer is empty, read the data from the input channel. | public void | setCharOutputChannel(CharOutputChannel out) When the buffer is full, write the data to the output channel. | public void | setChars(char[] c, int off, int len) | public void | setEnd(int i) | public void | setLimit(int limit) Maximum amount of data in this buffer. | public void | setOffset(int off) Returns the start offset of the bytes. | public void | setOptimizedWrite(boolean optimizedWrite) | public boolean | startsWith(String s) Returns true if the message bytes starts with the specified string. | public boolean | startsWithIgnoreCase(String s, int pos) Returns true if the message bytes starts with the specified string. | public CharSequence | subSequence(int start, int end) | public int | substract() | public int | substract(CharChunk src) | public int | substract(char src, int off, int len) | public String | toString() | public String | toStringInternal() |
CharChunk | public CharChunk()(Code) | | Creates a new, uninitialized CharChunk object.
|
CharChunk | public CharChunk(int size)(Code) | | |
allocate | public void allocate(int initial, int limit)(Code) | | |
append | public void append(char src, int off, int len) throws IOException(Code) | | Add data to the buffer
|
charAt | public char charAt(int index)(Code) | | |
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(char b2, int off2, int len2)(Code) | | |
equals | public boolean equals(byte b2, 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 |
getBuffer | public char[] getBuffer()(Code) | | |
getChars | public char[] getChars()(Code) | | |
getEnd | public int getEnd()(Code) | | |
getInt | public int getInt()(Code) | | |
getLength | public int getLength()(Code) | | Returns the length of the bytes.
|
getLimit | public int getLimit()(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(char c)(Code) | | |
indexOf | public int indexOf(char c, int starting)(Code) | | Returns true if the message bytes starts with the specified string.
Parameters: c - the character |
indexOf | public static int indexOf(char chars, int off, int cend, char qq)(Code) | | |
indexOf | public int indexOf(String src, int srcOff, int srcLen, int myOff)(Code) | | |
isNull | public boolean isNull()(Code) | | |
length | public int length()(Code) | | |
recycle | public void recycle()(Code) | | Resets the message bytes to an uninitialized state.
|
reset | public void reset()(Code) | | |
setCharInputChannel | public void setCharInputChannel(CharInputChannel in)(Code) | | When the buffer is empty, read the data from the input channel.
|
setCharOutputChannel | public void setCharOutputChannel(CharOutputChannel 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.
|
setChars | public void setChars(char[] c, int off, int len)(Code) | | |
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) | | Returns the start offset of the bytes.
|
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 |
startsWithIgnoreCase | public boolean startsWithIgnoreCase(String s, int pos)(Code) | | Returns true if the message bytes starts with the specified string.
Parameters: s - the string |
|
|