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

## com.autonomy.utilities
Class ByteArrayBuffer

    java.lang.Object
      |
      +--com.autonomy.utilities.ByteArrayBuffer

public class ByteArrayBuffer
extends java.lang.Object

Analogy of a StringBuffer but uses a byte array not a char array.
Useful for storing a dynamic set of bytes

Constructor Summary
`ByteArrayBuffer()` Creates a byte array buffer with a default size
`ByteArrayBuffer(byte[] bInitial)` Creates a byte array buffer from a byte array
`ByteArrayBuffer(int nSize)` Creates a byte array with a given size
`ByteArrayBuffer(java.lang.String sInitial, int nInitialSpace, java.lang.String sEncoding)` Constructor.

Method Summary
`void` | `append(byte b)` Append a single byte
`void` | `append(byte[] baAppend)` Append an entire byte array
`void` | `append(byte[] baAppend, int nToAppend)` Append a portion of a byte array
`void` | `append(byte[] baAppend, int nStart, int nToAppend)` Append a portion of a byte array
`void` | `append(com.autonomy.utilities.ByteArrayBuffer babAppend)` Append the entire contents of ByteArrayBuffer
`void` | `append(java.lang.String sAppend)` Append a string using the provided encoding
`byte[]` | `getBytes()` Return the byte array
`int` | `length()` Return the length of the current buffer
`void` | `setEncoding(java.lang.String sEncoding)` Set encoding used for coverting Strings to bytes
`java.lang.String` | `toString()` Convert the buffer to a string, using the character encoding specified in setEncoding

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

Constructor Detail

### ByteArrayBuffer

    public ByteArrayBuffer(java.lang.String sInitial,
                           int nInitialSpace,
                           java.lang.String sEncoding)

  Constructor. Takes an exsting string, converted to bytes using the given encoding and places into a buffer

Parameters:
  `sInitial` - Initial string to place in buffer
  `nInitialSpace` - How much space in bytes to give to the buffer
  `sEncoding` - Encoding to use to convert from String to bytes

### ByteArrayBuffer

    public ByteArrayBuffer()

  Creates a byte array buffer with a default size

### ByteArrayBuffer

    public ByteArrayBuffer(byte[] bInitial)

  Creates a byte array buffer from a byte array

Parameters:
  `bInitial` - Byte array to use a source for buffer

### ByteArrayBuffer

    public ByteArrayBuffer(int nSize)

  Creates a byte array with a given size

Parameters:
  `nSize` - Initial size for buffer

Method Detail

### setEncoding

    public void setEncoding(java.lang.String sEncoding)

  Set encoding used for coverting Strings to bytes

  Parameters:
    `sEncoding` - Encoding to use

### append

    public void append(java.lang.String sAppend)

  Append a string using the provided encoding

  Parameters:
    `sAppend` - String to append

### append

    public void append(byte[] baAppend,
                       int nToAppend)

  Append a portion of a byte array

  Parameters:
    `baAppend` - byte array to append
    `nToAppend` - Number of bytes to append, starting from the beginning of the array

### append

    public void append(byte[] baAppend,
                       int nStart,
                       int nToAppend)

  Append a portion of a byte array

  Parameters:
    `baAppend` - byte array to append
    `nStart` - Index in baAppend from which to start
    `nToAppend` - Number of bytes to append

### append

    public void append(byte[] baAppend)
                throws java.lang.ArrayStoreException

  Append an entire byte array

  Parameters:
    `baAppend` - Byte array
    `java.lang.ArrayStoreException`

### append

    public void append(com.autonomy.utilities.ByteArrayBuffer babAppend)
                throws java.lang.ArrayStoreException

  Append the entire contents of ByteArrayBuffer

    `java.lang.ArrayStoreException`

### append

    public void append(byte b)

  Append a single byte

  Parameters:
    `b` - Byte to append

### getBytes

    public byte[] getBytes()

  Return the byte array

### length

    public int length()

  Return the length of the current buffer

### toString

    public java.lang.String toString()

  Convert the buffer to a string, using the character encoding specified in setEncoding

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

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