Save This Page
Home » HttpComponents-Core-4.0.1 » org.apache.http.util » [javadoc | source]
org.apache.http.util
public final class: CharArrayBuffer [javadoc | source]
java.lang.Object
   org.apache.http.util.CharArrayBuffer
A resizable char array.
Constructor:
 public CharArrayBuffer(int capacity) 
    Parameters:
    capacity - the capacity
Method from org.apache.http.util.CharArrayBuffer Summary:
append,   append,   append,   append,   append,   append,   append,   append,   buffer,   capacity,   charAt,   clear,   ensureCapacity,   indexOf,   indexOf,   isEmpty,   isFull,   length,   setLength,   substring,   substringTrimmed,   toCharArray,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.http.util.CharArrayBuffer Detail:
 public  void append(String str) 
    Appends chars of the given string to this buffer. The capacity of the buffer is increased, if necessary, to accommodate all chars.
 public  void append(CharArrayBuffer b) 
    Appends all chars to this buffer from the given source buffer starting at index 0. The capacity of the destination buffer is increased, if necessary, to accommodate all #length() chars.
 public  void append(char ch) 
    Appends ch char to this buffer. The capacity of the buffer is increased, if necessary, to accommodate the additional char.
 public  void append(Object obj) 
    Appends chars of the textual representation of the given object to this buffer. The capacity of the buffer is increased, if necessary, to accommodate all chars.
 public  void append(char[] b,
    int off,
    int len) 
    Appends 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.
 public  void append(CharArrayBuffer b,
    int off,
    int len) 
    Appends 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.
 public  void append(byte[] b,
    int off,
    int len) 
    Appends 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.

 public  void append(ByteArrayBuffer b,
    int off,
    int len) 
    Appends 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.

 public char[] buffer() 
    Returns reference to the underlying char array.
 public int capacity() 
    Returns the current capacity. The capacity is the amount of storage available for newly appended chars, beyond which an allocation will occur.
 public char charAt(int i) 
    Returns the 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.
 public  void clear() 
    Clears content of the buffer. The underlying char array is not resized.
 public  void ensureCapacity(int required) 
    Ensures that the capacity is at least equal to the specified minimum. If the current capacity is less than the argument, then a new internal array is allocated with greater capacity. If the required argument is non-positive, this method takes no action.
 public int indexOf(int ch) 
    Returns the index within this buffer of the first occurrence of the specified character, starting the search at 0 and finishing at #length() . If no such character occurs in this buffer within those bounds, -1 is returned.
 public int indexOf(int ch,
    int beginIndex,
    int endIndex) 
    Returns the index within this buffer of the first occurrence of the specified character, starting the search at the specified 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.

 public boolean isEmpty() 
    Returns true if this buffer is empty, that is, its #length() is equal to 0.
 public boolean isFull() 
 public int length() 
    Returns the length of the buffer (char count).
 public  void setLength(int len) 
    Sets the length of the buffer. The new length value is expected to be less than the current capacity and greater than or equal to 0.
 public String substring(int beginIndex,
    int endIndex) 
    Returns a substring of this buffer. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1.
 public String substringTrimmed(int beginIndex,
    int endIndex) 
    Returns a substring of this buffer with leading and trailing whitespace omitted. The substring begins with the first non-whitespace character from beginIndex and extends to the last non-whitespace character with the index lesser than endIndex.
 public char[] toCharArray() 
    Converts the content of this buffer to an array of chars.
 public String toString()