| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.http.util.CharArrayBuffer
public final class CharArrayBuffer
A resizable char array.
| Constructor Summary | |
|---|---|
| CharArrayBuffer(int capacity)Creates an instance of CharArrayBufferwith the given initial
 capacity. | |
| Method Summary | |
|---|---|
|  void | append(byte[] b,
       int off,
       int len)Appends lenbytes to this buffer from the given source
 array starting at indexoff. | 
|  void | append(ByteArrayBuffer b,
       int off,
       int len)Appends lenbytes to this buffer from the given source
 array starting at indexoff. | 
|  void | append(char ch)Appends chchar to this buffer. | 
|  void | append(char[] b,
       int off,
       int len)Appends lenchars to this buffer from the given source
 array starting at indexoff. | 
|  void | append(CharArrayBuffer b)Appends all chars to this buffer from the given source buffer starting at index 0. | 
|  void | append(CharArrayBuffer b,
       int off,
       int len)Appends lenchars to this buffer from the given source
 buffer starting at indexoff. | 
|  void | append(Object obj)Appends chars of the textual representation of the given object to this buffer. | 
|  void | append(String str)Appends chars of the given string to this buffer. | 
|  char[] | buffer()Returns reference to the underlying char array. | 
|  int | capacity()Returns the current capacity. | 
|  char | charAt(int i)Returns the charvalue in this buffer at the specified
 index. | 
|  void | clear()Clears content of the buffer. | 
|  void | ensureCapacity(int required)Ensures that the capacity is at least equal to the specified minimum. | 
|  int | indexOf(int ch)Returns the index within this buffer of the first occurrence of the specified character, starting the search at 0and finishing
 atlength(). | 
|  int | indexOf(int ch,
        int from,
        int to)Returns the index within this buffer of the first occurrence of the specified character, starting the search at the specified beginIndexand finishing atendIndex. | 
|  boolean | isEmpty()Returns trueif this buffer is empty, that is, itslength()is equal to0. | 
|  boolean | isFull()Returns trueif this buffer is full, that is, itslength()is equal to itscapacity(). | 
|  int | length()Returns the length of the buffer (char count). | 
|  void | setLength(int len)Sets the length of the buffer. | 
|  CharSequence | subSequence(int beginIndex,
            int endIndex) | 
|  String | substring(int beginIndex,
          int endIndex)Returns a substring of this buffer. | 
|  String | substringTrimmed(int beginIndex,
                 int endIndex)Returns a substring of this buffer with leading and trailing whitespace omitted. | 
|  char[] | toCharArray()Converts the content of this buffer to an array of chars. | 
|  String | toString() | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public CharArrayBuffer(int capacity)
CharArrayBuffer with the given initial
 capacity.
capacity - the capacity| Method Detail | 
|---|
public void append(char[] b,
                   int off,
                   int len)
len chars to this buffer from the given source
 array starting at index off. The capacity of the buffer
 is increased, if necessary, to accommodate all len chars.
b - the chars to be appended.off - the index of the first char to append.len - the number of chars to append.
IndexOutOfBoundsException - if off is out of
 range, len is negative, or
 off + len is out of range.public void append(String str)
str - the string.
public void append(CharArrayBuffer b,
                   int off,
                   int len)
len chars to this buffer from the given source
 buffer starting at index off. The capacity of the
 destination buffer is increased, if necessary, to accommodate all
 len chars.
b - the source buffer to be appended.off - the index of the first char to append.len - the number of chars to append.
IndexOutOfBoundsException - if off is out of
 range, len is negative, or
 off + len is out of range.public void append(CharArrayBuffer b)
0. The capacity of the destination buffer is
 increased, if necessary, to accommodate all length() chars.
b - the source buffer to be appended.public void append(char ch)
ch char to this buffer. The capacity of the buffer
 is increased, if necessary, to accommodate the additional char.
ch - the char to be appended.
public void append(byte[] b,
                   int off,
                   int len)
len bytes to this buffer from the given source
 array starting at index off. The capacity of the buffer
 is increased, if necessary, to accommodate all len bytes.
 The bytes are converted to chars using simple cast.
b - the bytes to be appended.off - the index of the first byte to append.len - the number of bytes to append.
IndexOutOfBoundsException - if off is out of
 range, len is negative, or
 off + len is out of range.
public void append(ByteArrayBuffer b,
                   int off,
                   int len)
len bytes to this buffer from the given source
 array starting at index off. The capacity of the buffer
 is increased, if necessary, to accommodate all len bytes.
 The bytes are converted to chars using simple cast.
b - the bytes to be appended.off - the index of the first byte to append.len - the number of bytes to append.
IndexOutOfBoundsException - if off is out of
 range, len is negative, or
 off + len is out of range.public void append(Object obj)
obj - the object.public void clear()
public char[] toCharArray()
public char charAt(int i)
char value in this buffer at the specified
 index. The index argument must be greater than or equal to
 0, and less than the length of this buffer.
charAt in interface CharSequencei - the index of the desired char value.
IndexOutOfBoundsException - if index is
             negative or greater than or equal to length().public char[] buffer()
public int capacity()
public int length()
length in interface CharSequencepublic void ensureCapacity(int required)
required
 argument is non-positive, this method takes no action.
required - the minimum required capacity.public void setLength(int len)
0.
len - the new length
IndexOutOfBoundsException - if the
               len argument is greater than the current
               capacity of the buffer or less than 0.public boolean isEmpty()
true if this buffer is empty, that is, its
 length() is equal to 0.
true if this buffer is empty, false
   otherwise.public boolean isFull()
true if this buffer is full, that is, its
 length() is equal to its capacity().
true if this buffer is full, false
   otherwise.
public int indexOf(int ch,
                   int from,
                   int to)
beginIndex and finishing at endIndex.
 If no such character occurs in this buffer within the specified bounds,
 -1 is returned.
 
 There is no restriction on the value of beginIndex and
 endIndex. If beginIndex is negative,
 it has the same effect as if it were zero. If endIndex is
 greater than length(), it has the same effect as if it were
 length(). If the beginIndex is greater than
 the endIndex, -1 is returned.
ch - the char to search for.from - the index to start the search from.to - the index to finish the search at.
-1 if the character does
   not occur.public int indexOf(int ch)
0 and finishing
 at length(). If no such character occurs in this buffer within
 those bounds, -1 is returned.
ch - the char to search for.
-1 if the character does not occur.
public String substring(int beginIndex,
                        int endIndex)
beginIndex and extends to the character at index
 endIndex - 1.
beginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.
StringIndexOutOfBoundsException - if the
             beginIndex is negative, or
             endIndex is larger than the length of this
             buffer, or beginIndex is larger than
             endIndex.
public String substringTrimmed(int beginIndex,
                               int endIndex)
beginIndex and extends to the last
 non-whitespace character with the index lesser than
 endIndex.
beginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.
IndexOutOfBoundsException - if the
             beginIndex is negative, or
             endIndex is larger than the length of this
             buffer, or beginIndex is larger than
             endIndex.
public CharSequence subSequence(int beginIndex,
                                int endIndex)
subSequence in interface CharSequencepublic String toString()
toString in interface CharSequencetoString in class Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||