ANTS v2.0 API

ants.core
Class ByteArray

java.lang.Object
  |
  +--ants.core.ByteArray

public class ByteArray
extends java.lang.Object

Wrapper for an array of Bytes. Incorporates offset and length.

Most of the methods in here are final for performance reasons.

Author:
probably David Wetherall.

Field Summary
 byte[] buf
           
 int len
           
 int offset
           
 
Constructor Summary
ByteArray(byte[] buf)
           
ByteArray(byte[] buf, int offset)
           
ByteArray(byte[] buf, int offset, int len)
           
ByteArray(ByteArray parent, int offset)
           
ByteArray(ByteArray parent, int offset, int len)
           
ByteArray(int len)
           
 
Method Summary
 byte getByte(int index)
           
 void getBytes(int srcBegin, byte[] dst, int dstBegin, int length)
           
 int length()
           
 void setByte(int index, byte val)
           
 void setBytes(int dstBegin, byte[] src, int srcBegin, int length)
           
 void setBytes(int dstBegin, ByteArray src, int srcBegin, int length)
           
 byte[] toBytes()
          Returns a byte array exactly the right size for the valid data in the buf.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buf

public byte[] buf

offset

public int offset

len

public int len
Constructor Detail

ByteArray

public ByteArray(int len)

ByteArray

public ByteArray(byte[] buf)

ByteArray

public ByteArray(byte[] buf,
                 int offset)

ByteArray

public ByteArray(byte[] buf,
                 int offset,
                 int len)
          throws java.lang.IndexOutOfBoundsException

ByteArray

public ByteArray(ByteArray parent,
                 int offset)

ByteArray

public ByteArray(ByteArray parent,
                 int offset,
                 int len)
          throws java.lang.IndexOutOfBoundsException
Method Detail

length

public final int length()

getByte

public final byte getByte(int index)
                   throws java.lang.IndexOutOfBoundsException

setByte

public final void setByte(int index,
                          byte val)
                   throws java.lang.IndexOutOfBoundsException

getBytes

public final void getBytes(int srcBegin,
                           byte[] dst,
                           int dstBegin,
                           int length)

setBytes

public final void setBytes(int dstBegin,
                           byte[] src,
                           int srcBegin,
                           int length)

setBytes

public final void setBytes(int dstBegin,
                           ByteArray src,
                           int srcBegin,
                           int length)

toBytes

public final byte[] toBytes()
Returns a byte array exactly the right size for the valid data in the buf. Note that if this.buf is the right side it is returned directly, otherwise a new array is created of the right size. (Weird.)
Returns:
array of bytes

toString

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

ANTS v2.0 API

This documentation is Copyright (C) 1998-2001 The University of Utah and the University of Washington. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for ANTS v2.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/