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.CharSegment
            |
            +--com.caucho.util.CharBuffer

public final class CharBuffer
extends CharSegment

CharBuffer is an unsynchronized version of StringBuffer.

Fields inherited from class com.caucho.util.CharSegment
`buffer, length, offset`

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.
`void` | `ensureCapacity(int minimumCapacity)` Ensure the buffer can hold at least 'minimumCapacity' chars.
`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` | `indexOf(char ch)` Returns the index of a character in the CharSegment.
`int` | `indexOf(char ch, int start)` Returns the index of a character in the CharSegment starting from an offset.
`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)` Returns the last index of a character in the CharSegment.
`int` | `lastIndexOf(char ch, int start)` Returns the last index of a character in the CharSegment starting from an offset.
`int` | `length()` Returns the character count of the buffer's contents.
`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.
`java.lang.String` | `substring(int start)` Returns a substring
`java.lang.String` | `substring(int start, int end)` Returns a substring
`java.lang.String` | `toString()` String representation of the buffer.

Methods inherited from class com.caucho.util.CharSegment
`endsWith, endsWith, equals, equals, equals, equalsIgnoreCase, equalsIgnoreCase, getOffset, hashCode, init, matches, matches, matchesIgnoreCase, regionMatches, regionMatches, regionMatchesIgnoreCase, startsWith, toLowerCase`

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.
  Overrides:
    `length` in class `CharSegment`

### getLength

    public int getLength()

  Returns the buffer length
  Overrides:
    `getLength` in class `CharSegment`

### 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.
  Overrides:
    `charAt` in class `CharSegment`

### getLastChar

    public char getLastChar()

  Returns the last character of the buffer
  Overrides:
    `getLastChar` in class `CharSegment`
  Throws:
    `IndexOutOfBoundsException` - for an empty buffer

### getBuffer

    public final char[] getBuffer()

  Returns the buffer's char array.
  Overrides:
    `getBuffer` in class `CharSegment`

### getChars

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

  Copies characters to the destination buffer.
  Overrides:
    `getChars` in class `CharSegment`

### 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
  Overrides:
    `substring` in class `CharSegment`

### substring

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

  Returns a substring
  Overrides:
    `substring` in class `CharSegment`

### 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)

  Description copied from class: `CharSegment`
  Returns the index of a character in the CharSegment starting from an offset.
  Overrides:
    `indexOf` in class `CharSegment`

### indexOf

    public int indexOf(char ch)

  Description copied from class: `CharSegment`
  Returns the index of a character in the CharSegment.
  Overrides:
    `indexOf` in class `CharSegment`

### lastIndexOf

    public int lastIndexOf(char ch,
                           int start)

  Description copied from class: `CharSegment`
  Returns the last index of a character in the CharSegment starting from an offset.
  Overrides:
    `lastIndexOf` in class `CharSegment`

### lastIndexOf

    public int lastIndexOf(char ch)

  Description copied from class: `CharSegment`
  Returns the last index of a character in the CharSegment.
  Overrides:
    `lastIndexOf` in class `CharSegment`

### clone

    public java.lang.Object clone()

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

### toString

    public java.lang.String toString()

  String representation of the buffer.
  Overrides:
    `toString` in class `CharSegment`

### 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