com.zipxap.vfs.dal.utility
Class ByteBuilder

java.lang.Object
  extended by com.zipxap.vfs.dal.utility.ByteBuilder

public class ByteBuilder
extends java.lang.Object

Helper class for creating a large sequence of bytes. Think of it as the byte equivalent of StringBuilder

This class is part of the KavaPL base API.

MilestoneWhoDate, Time
Initial VersionK PenroseJune 24, 2007, 5:33 PM

** Note that this table is not intended as an exhaustive list of subtle changes. It is intended to list changes that break the compatibility of older code, or major enhancements/rewrites


Field Summary
static int CHUNK_SIZE
           
 
Constructor Summary
ByteBuilder()
           
ByteBuilder(byte[] bytes)
           
 
Method Summary
 void append(byte[] bytes)
           
 void append(byte[] bytes, int bytesToAppend)
          appends the first 'bytesToAppend' bytes from 'bytes'
 void discard(int bytesToDiscard)
          Discard the first bytesToDiscard bytes from the byte array.
 int size()
           
 byte[] toByteArray()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHUNK_SIZE

public static final int CHUNK_SIZE
See Also:
Constant Field Values
Constructor Detail

ByteBuilder

public ByteBuilder()

ByteBuilder

public ByteBuilder(byte[] bytes)
Method Detail

append

public void append(byte[] bytes)

append

public void append(byte[] bytes,
                   int bytesToAppend)
appends the first 'bytesToAppend' bytes from 'bytes'


discard

public void discard(int bytesToDiscard)
Discard the first bytesToDiscard bytes from the byte array.

Parameters:
bytesToDiscard - The number of bytes to discard from the byte array.
Throws:
UCIllegalArgumentException - if bytesToDiscard is not between 0 and size().

size

public int size()
Returns:
The number of bytes in the ByteBuilder.

toByteArray

public byte[] toByteArray()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object