org.equanda.util
Class ByteBuffer

java.lang.Object
  extended by org.equanda.util.ByteBuffer

public final class ByteBuffer
extends Object

ByteBuffer is similar to StringBuffer and manages an automatically expanding array of bytes. Contrary to StringBuffer, this class is not synchronized.

Author:
Joachim Van der Auwera

Constructor Summary
ByteBuffer()
           
ByteBuffer(byte[] value)
           
ByteBuffer(int size)
           
 
Method Summary
 void append(byte value)
           
 void append(byte[] value)
           
 void append(byte[] value, int offset, int width)
           
 void append(ByteBuffer value)
           
 byte byteAt(int index)
           
 int capacity()
           
 void delete(int pos, int width)
           
 void ensureCapacity(int size)
           
 int getArrayAt(int pos, byte[] buffer, int offset, int width)
           
 void insert(byte[] value, int pos)
           
 void insert(ByteBuffer value, int pos)
           
 void insert(byte value, int pos)
           
 int length()
           
 void pack()
           
 void replace(byte[] value, int pos, int width)
           
 void replace(ByteBuffer value, int pos, int width)
           
 void setByteAt(int index, byte value)
           
 void setLength(int value)
           
 byte[] toByteArray()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteBuffer

public ByteBuffer(int size)

ByteBuffer

public ByteBuffer(byte[] value)

ByteBuffer

public ByteBuffer()
Method Detail

capacity

public int capacity()

ensureCapacity

public void ensureCapacity(int size)

pack

public void pack()

append

public void append(byte value)

append

public void append(byte[] value)

append

public void append(byte[] value,
                   int offset,
                   int width)

append

public void append(ByteBuffer value)

insert

public void insert(byte[] value,
                   int pos)

insert

public void insert(ByteBuffer value,
                   int pos)

insert

public void insert(byte value,
                   int pos)

delete

public void delete(int pos,
                   int width)

replace

public void replace(byte[] value,
                    int pos,
                    int width)

replace

public void replace(ByteBuffer value,
                    int pos,
                    int width)

toByteArray

public byte[] toByteArray()

toString

public String toString()
Overrides:
toString in class Object

length

public int length()

setLength

public void setLength(int value)

byteAt

public byte byteAt(int index)

getArrayAt

public int getArrayAt(int pos,
                      byte[] buffer,
                      int offset,
                      int width)

setByteAt

public void setByteAt(int index,
                      byte value)


Copyright © 2007-2009. All Rights Reserved.