Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| RichFaces Core API 4.2.2.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ajax4jsf.io
Class CharBuffer

    java.lang.Object
      org.ajax4jsf.io.CharBuffer

    public class CharBuffer

extends Object

A single link in chain of char arrays.

Author:
  glory

Constructor Summary
`CharBuffer(char[] chars)` Creates instance of CharBuffer already filled by chars.
`CharBuffer(int cacheSize)` Creates instance of CharBuffer with char array of required length.

Method Summary
`CharBuffer` | `append(char c)` Appends character to array chars if there are unfilled positions in it.
`CharBuffer` | `append(char[] cs, int off, int len)` Appends segment of a char array to array if there are unfilled positions in it.
`void` | `compact()`
`int` | `getCacheSize()` Returns capacity of this link.
`char` | `getCharAt(int index)` Returns character at index.
`char[]` | `getChars()` Returns stored char array.
`CharBuffer` | `getNext()` Returns the next link in the chain.
`CharBuffer` | `getPrevious()` Returns the previous link in the chain.
`int` | `getTotalSize()` Returns total number of characters stored in this link and all its predecessors.
`int` | `getUsedSize()` Returns actual number of characters stored in this link.
`void` | `reset()` Resets this char buffer to empty state
`void` | `setNext(CharBuffer b)` Sets the next link in the chain.
`ByteBuffer` | `toByteBuffer()` Transforms this instance to instance of ByteBuffer (a link of chain of byte arrays).
`ByteBuffer` | `toByteBuffer(String encoding)` Transforms this instance to instance of ByteBuffer (a link of chain of byte arrays).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CharBuffer

    public CharBuffer(char[] chars)

  Creates instance of CharBuffer already filled by chars.

  Parameters:
    `bytes` -

### CharBuffer

    public CharBuffer(int cacheSize)

  Creates instance of CharBuffer with char array of required length.

  Parameters:
    `cacheSize` - length of char array

Method Detail

### append

    public CharBuffer append(char c)

  Appends character to array chars if there are unfilled positions in it. Otherwise creates next link in the chain, and appends the character to it.

  Parameters:
    `c` -
  Returns:
    instance of CharBuffer to which character was appended.

### append

    public CharBuffer append(char[] cs,
                             int off,
                             int len)

  Appends segment of a char array to array if there are unfilled positions in it. Otherwise creates next link in the chain, and appends data to it.

  Parameters:
    `c` -
  Returns:
    instance of CharBuffer to which char array was appended.

### getChars

    public char[] getChars()

  Returns stored char array.

  Returns:
    stored char array

### getCharAt

    public char getCharAt(int index)

  Returns character at index. No check is fulfilled to provide high speed.

  Parameters:
    `index` -
  Returns:

### getUsedSize

    public int getUsedSize()

  Returns actual number of characters stored in this link.

  Returns:

### getCacheSize

    public int getCacheSize()

  Returns capacity of this link.

  Returns:

### getTotalSize

    public int getTotalSize()

  Returns total number of characters stored in this link and all its predecessors.

  Returns:

### getPrevious

    public CharBuffer getPrevious()

  Returns the previous link in the chain.

  Returns:

### getNext

    public CharBuffer getNext()

  Returns the next link in the chain.

  Returns:

### setNext

    public void setNext(CharBuffer b)

  Sets the next link in the chain.

  Parameters:
    `b` -

### toByteBuffer

    public ByteBuffer toByteBuffer(String encoding)
                            throws UnsupportedEncodingException

  Transforms this instance to instance of ByteBuffer (a link of chain of byte arrays).

  Parameters:
    `encoding` -
  Returns:
    link of chain of byte arrays
  Throws:
    `UnsupportedEncodingException`

### toByteBuffer

    public ByteBuffer toByteBuffer()

  Transforms this instance to instance of ByteBuffer (a link of chain of byte arrays).

  Returns:
    link of chain of byte arrays

### reset

    public void reset()

  Resets this char buffer to empty state

  Since:
    3.3.0

### compact

    public void compact()

  Since:
    4.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| RichFaces Core API 4.2.2.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.