org.activemq.io.util
Class ByteArray

java.lang.Object
  extended by org.activemq.io.util.ByteArray

public class ByteArray
extends Object

Simple holder for a an array of Bytes - used instead of a ByteBuffer to avoid unecessary System.array() copies

Version:
$Revision: 1.1.1.1 $

Constructor Summary
ByteArray()
          Construct an empty ByteArray
ByteArray(byte[] buf)
          Create a byte array
ByteArray(byte[] buf, int offset, int length)
          Create a ByteArray
 
Method Summary
 void clear()
          clear the values held by this ByteArray
 ByteArray copy()
          make a copy
 byte get(int position)
          return the byte at the position
 byte[] getBuf()
           
 int getLength()
           
 int getOffset()
           
 void reset(byte[] buf)
          reset values
 void reset(byte[] buf, int offset, int length)
          reset values
 void setBuf(byte[] buf)
           
 void setLength(int length)
           
 void setOffset(int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArray

public ByteArray()
Construct an empty ByteArray


ByteArray

public ByteArray(byte[] buf)
Create a byte array

Parameters:
buf -

ByteArray

public ByteArray(byte[] buf,
                 int offset,
                 int length)
Create a ByteArray

Parameters:
buf -
offset -
length -
Method Detail

clear

public void clear()
clear the values held by this ByteArray


reset

public void reset(byte[] buf)
reset values

Parameters:
buf -

reset

public void reset(byte[] buf,
                  int offset,
                  int length)
reset values

Parameters:
buf -
offset -
length -

getBuf

public byte[] getBuf()
Returns:
Returns the buf.

setBuf

public void setBuf(byte[] buf)
Parameters:
buf - The buf to set.

getLength

public int getLength()
Returns:
Returns the length.

setLength

public void setLength(int length)
Parameters:
length - The length to set.

getOffset

public int getOffset()
Returns:
Returns the offset.

setOffset

public void setOffset(int offset)
Parameters:
offset - The offset to set.

get

public byte get(int position)
return the byte at the position

Parameters:
position -
Returns:

copy

public ByteArray copy()
make a copy

Returns:
a copy of it's self


Copyright © 2004-2010 Protique, Ltd.. All Rights Reserved.