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

## org.ajax4jsf.io
Class ByteBuffer

    java.lang.Object
      org.ajax4jsf.io.ByteBuffer

    public class ByteBuffer

extends Object

A single link in chain of byte arrays.

Author:
  glory

Constructor Summary
`ByteBuffer(byte[] bytes)` Creates instance of ByteBuffer already filled by bytes.
`ByteBuffer(int cacheSize)` Creates instance of ByteBuffer with byte array of required length.

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

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

Constructor Detail

### ByteBuffer

    public ByteBuffer(byte[] bytes)

  Creates instance of ByteBuffer already filled by bytes.

  Parameters:
    `bytes` -

### ByteBuffer

    public ByteBuffer(int cacheSize)

  Creates instance of ByteBuffer with byte array of required length.

  Parameters:
    `cacheSize` - length of byte array

Method Detail

### append

    public ByteBuffer append(byte c)

  Appends byte to array if there are unfilled positions in it. Otherwize creates next link in the chain, and appends the byte to it.

  Parameters:
    `c` -
  Returns:
    instance of ByteBuffer to which byte was appended.

### append

    public ByteBuffer append(byte[] bs,
                             int off,
                             int len)

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

  Parameters:
    `c` -
  Returns:
    instance of ByteBuffer to which byte array was appended.

### getBytes

    public byte[] getBytes()

  Returns stored byte array.

  Returns:
    stored byte array

### getByteAt

    public byte getByteAt(int index)

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

  Parameters:
    `index` -
  Returns:

### getUsedSize

    public int getUsedSize()

  Returns actual number of byte stored in this link.

  Returns:

### getCacheSize

    public int getCacheSize()

  Returns capacity of this link.

  Returns:

### getTotalSize

    public int getTotalSize()

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

  Returns:

### getPrevious

    public ByteBuffer getPrevious()

  Returns the previous link in the chain.

  Returns:

### getNext

    public ByteBuffer getNext()

  Returns the next link in the chain.

  Returns:

### setNext

    public void setNext(ByteBuffer b)

  Sets the next link in the chain.

  Parameters:
    `b` -

### toCharBuffer

    public CharBuffer toCharBuffer(String encoding)
                            throws UnsupportedEncodingException

  Transforms this instance to instance of CharBuffer (a link of chain of char arrays).

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

### toCharBuffer

    public CharBuffer toCharBuffer()

  Transforms this instance to instance of CharBuffer (a link of chain of char arrays).

  Returns:
    link of chain of char arrays

### reset

    public void reset()

  Resets this byte buffer to empty state

  Since:
    3.3.0

### compact

    public void compact()

  Since:
    4.0

### getLast

    public ByteBuffer getLast()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| RichFaces Core API 4.2.0.CR1
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.