Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.caucho.util
Class CharBuffer

    java.lang.Object
      |
      +--com.caucho.util.CharBuffer

public final class CharBuffer
extends java.lang.Object

CharBuffer is an unsynchronized version of StringBuffer.

Constructor Summary
`CharBuffer()` Constructs a char buffer with no characters.
`CharBuffer(int capacity)` Constructs a char buffer with the given initial capacity
`CharBuffer(java.lang.String string)` Constructs a char buffer with the given initial string
`CharBuffer(java.lang.String string, int offset, int length)` Constructs a char buffer with the given initial string

Method Summary
`static CharBuffer` | `allocate()`
`CharBuffer` | `append(boolean b)` Appends the boolean representation to the buffer
`CharBuffer` | `append(byte[] buf, int offset, int len)` Appends iso-8859-1 bytes to the buffer
`CharBuffer` | `append(char ch)` Appends the character to the buffer
`CharBuffer` | `append(char[] buffer)` Appends the characters to the buffer.
`CharBuffer` | `append(char[] buffer, int offset, int length)` Appends the characters to the buffer.
`CharBuffer` | `append(CharBuffer cb)` Appends the string representation of the object to the buffer.
`CharBuffer` | `append(double d)` Add a double to the buffer.
`CharBuffer` | `append(float f)` Add a float to the buffer.
`CharBuffer` | `append(int i)` Add an int to the buffer.
`CharBuffer` | `append(long i)` Add a long to the buffer.
`CharBuffer` | `append(java.lang.Object obj)` Appends the string representation of the object to the buffer.
`CharBuffer` | `append(java.lang.String string)` Appends the string.
`CharBuffer` | `append(java.lang.String string, int offset, int len)`
`int` | `capacity()` Returns the capacity of the buffer, i.e.
`char` | `charAt(int i)` Returns the char at the specified offset.
`void` | `clear()` Clears the buffer.
`java.lang.Object` | `clone()` Clones the buffer
`java.lang.String` | `close()`
`CharBuffer` | `delete(int start, int end)` Deletes characters from the buffer.
`CharBuffer` | `deleteCharAt(int index)` Deletes a character from the buffer.
`boolean` | `endsWith(java.lang.String string)`
`void` | `ensureCapacity(int minimumCapacity)` Ensure the buffer can hold at least 'minimumCapacity' chars.
`boolean` | `equals(CharBuffer cb)`
`boolean` | `equals(java.lang.Object a)`
`boolean` | `equalsIgnoreCase(CharBuffer b)`
`boolean` | `equalsIgnoreCase(java.lang.String a)`
`void` | `free()`
`char[]` | `getBuffer()` Returns the buffer's char array.
`int` | `getCapacity()`
`void` | `getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)` Copies characters to the destination buffer.
`java.io.InputStream` | `getInputStream()`
`char` | `getLastChar()` Returns the last character of the buffer
`int` | `getLength()` Returns the buffer length
`int` | `hashCode()` Returns the buffer's hash code
`int` | `indexOf(char ch)`
`int` | `indexOf(char ch, int start)`
`CharBuffer` | `insert(int offset, char ch)` Inserts a character at a given offset.
`CharBuffer` | `insert(int index, char[] buffer, int offset, int len)` Inserts a character buffer.
`CharBuffer` | `insert(int offset, double d)` Inserts a double at a given offset.
`CharBuffer` | `insert(int offset, float f)` Inserts a float at a given offset.
`CharBuffer` | `insert(int offset, int i)` Inserts an integer at a given offset.
`CharBuffer` | `insert(int offset, long l)` Inserts a long at a given offset.
`CharBuffer` | `insert(int offset, java.lang.Object o)` Inserts an object at a given offset.
`CharBuffer` | `insert(int index, java.lang.String string)` Inserts a string.
`int` | `lastIndexOf(char ch)`
`int` | `lastIndexOf(char ch, int start)`
`int` | `length()` Returns the character count of the buffer's contents.
`boolean` | `matches(java.lang.Object a)`
`boolean` | `matches(java.lang.String sa)`
`boolean` | `matchesIgnoreCase(java.lang.String sa)`
`boolean` | `regionMatches(int off1, CharBuffer buf, int off2, int len)`
`boolean` | `regionMatches(int off1, java.lang.String buf, int off2, int len)`
`boolean` | `regionMatchesIgnoreCase(int off1, CharBuffer buf, int off2, int len)`
`CharBuffer` | `replace(int start, int end, char[] buffer, int offset, int len)` Replaces a range with a character array
`CharBuffer` | `replace(int start, int end, java.lang.String string)` Replaces a range with a string
`void` | `setCharAt(int index, char ch)` Sets the character at the given index.
`void` | `setLength(int newLength)` Set the length of the buffer.
`boolean` | `startsWith(java.lang.String string)`
`java.lang.String` | `substring(int start)` Returns a substring
`java.lang.String` | `substring(int start, int end)` Returns a substring
`CharBuffer` | `toLowerCase()`
`java.lang.String` | `toString()` String representation of the buffer.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CharBuffer

    public CharBuffer()

  Constructs a char buffer with no characters.

### CharBuffer

    public CharBuffer(int capacity)

  Constructs a char buffer with the given initial capacity
  Parameters:
    `capacity` - initial capacity

### CharBuffer

    public CharBuffer(java.lang.String string)

  Constructs a char buffer with the given initial string
  Parameters:
    `string` - initial string

### CharBuffer

    public CharBuffer(java.lang.String string,
                      int offset,
                      int length)

  Constructs a char buffer with the given initial string
  Parameters:
    `string` - initial string

Method Detail

### allocate

    public static CharBuffer allocate()

### free

    public void free()

### length

    public int length()

  Returns the character count of the buffer's contents.

### getLength

    public int getLength()

  Returns the buffer length

### capacity

    public int capacity()

  Returns the capacity of the buffer, i.e. how many chars it can hold.

### getCapacity

    public int getCapacity()

### ensureCapacity

    public void ensureCapacity(int minimumCapacity)

  Ensure the buffer can hold at least 'minimumCapacity' chars.

### clear

    public final void clear()

  Clears the buffer. Equivalent to setLength(0)

### setLength

    public final void setLength(int newLength)

  Set the length of the buffer.

### charAt

    public char charAt(int i)

  Returns the char at the specified offset.

### getLastChar

    public char getLastChar()

  Returns the last character of the buffer
  Throws:
    `IndexOutOfBoundsException` - for an empty buffer

### getBuffer

    public final char[] getBuffer()

  Returns the buffer's char array.

### getChars

    public void getChars(int srcBegin,
                         int srcEnd,
                         char[] dst,
                         int dstBegin)

  Copies characters to the destination buffer.

### setCharAt

    public void setCharAt(int index,
                          char ch)

  Sets the character at the given index.

### append

    public CharBuffer append(java.lang.Object obj)

  Appends the string representation of the object to the buffer.

### append

    public CharBuffer append(CharBuffer cb)

  Appends the string representation of the object to the buffer.

### append

    public CharBuffer append(java.lang.String string)

  Appends the string.

### append

    public CharBuffer append(java.lang.String string,
                             int offset,
                             int len)

### append

    public CharBuffer append(char[] buffer)

  Appends the characters to the buffer.

### append

    public CharBuffer append(char[] buffer,
                             int offset,
                             int length)

  Appends the characters to the buffer.

### append

    public final CharBuffer append(boolean b)

  Appends the boolean representation to the buffer

### append

    public final CharBuffer append(char ch)

  Appends the character to the buffer

### append

    public CharBuffer append(int i)

  Add an int to the buffer.

### append

    public CharBuffer append(long i)

  Add a long to the buffer.

### append

    public CharBuffer append(float f)

  Add a float to the buffer.

### append

    public CharBuffer append(double d)

  Add a double to the buffer.

### append

    public final CharBuffer append(byte[] buf,
                                   int offset,
                                   int len)

  Appends iso-8859-1 bytes to the buffer

### delete

    public CharBuffer delete(int start,
                             int end)

  Deletes characters from the buffer.

### deleteCharAt

    public CharBuffer deleteCharAt(int index)

  Deletes a character from the buffer.

### replace

    public CharBuffer replace(int start,
                              int end,
                              java.lang.String string)

  Replaces a range with a string

### replace

    public CharBuffer replace(int start,
                              int end,
                              char[] buffer,
                              int offset,
                              int len)

  Replaces a range with a character array

### substring

    public java.lang.String substring(int start)

  Returns a substring

### substring

    public java.lang.String substring(int start,
                                      int end)

  Returns a substring

### insert

    public CharBuffer insert(int index,
                             java.lang.String string)

  Inserts a string.

### insert

    public CharBuffer insert(int index,
                             char[] buffer,
                             int offset,
                             int len)

  Inserts a character buffer.

### insert

    public CharBuffer insert(int offset,
                             java.lang.Object o)

  Inserts an object at a given offset.

### insert

    public CharBuffer insert(int offset,
                             char ch)

  Inserts a character at a given offset.

### insert

    public CharBuffer insert(int offset,
                             int i)

  Inserts an integer at a given offset.

### insert

    public CharBuffer insert(int offset,
                             long l)

  Inserts a long at a given offset.

### insert

    public CharBuffer insert(int offset,
                             float f)

  Inserts a float at a given offset.

### insert

    public CharBuffer insert(int offset,
                             double d)

  Inserts a double at a given offset.

### indexOf

    public int indexOf(char ch,
                       int start)

### indexOf

    public int indexOf(char ch)

### lastIndexOf

    public int lastIndexOf(char ch,
                           int start)

### lastIndexOf

    public int lastIndexOf(char ch)

### clone

    public java.lang.Object clone()

  Clones the buffer
  Overrides:
    `clone` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Returns the buffer's hash code
  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public final boolean equals(java.lang.Object a)

  Overrides:
    `equals` in class `java.lang.Object`

### equals

    public final boolean equals(CharBuffer cb)

### equalsIgnoreCase

    public final boolean equalsIgnoreCase(java.lang.String a)

### equalsIgnoreCase

    public final boolean equalsIgnoreCase(CharBuffer b)

### matches

    public boolean matches(java.lang.Object a)

### matches

    public boolean matches(java.lang.String sa)

### matchesIgnoreCase

    public boolean matchesIgnoreCase(java.lang.String sa)

### regionMatches

    public boolean regionMatches(int off1,
                                 CharBuffer buf,
                                 int off2,
                                 int len)

### regionMatches

    public boolean regionMatches(int off1,
                                 java.lang.String buf,
                                 int off2,
                                 int len)

### toLowerCase

    public CharBuffer toLowerCase()

### regionMatchesIgnoreCase

    public boolean regionMatchesIgnoreCase(int off1,
                                           CharBuffer buf,
                                           int off2,
                                           int len)

### startsWith

    public boolean startsWith(java.lang.String string)

### endsWith

    public boolean endsWith(java.lang.String string)

### toString

    public java.lang.String toString()

  String representation of the buffer.
  Overrides:
    `toString` in class `java.lang.Object`

### close

    public java.lang.String close()

### getInputStream

    public java.io.InputStream getInputStream()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD