public class

ByteArray

extends Object
java.lang.Object
   ↳ com.google.code.com.sun.mail.iap.ByteArray

Class Overview

A simple wrapper around a byte array, with a start position and count of bytes.

Summary

Fields
private byte[] bytes
private int count
private int start
Public Constructors
ByteArray(byte[] b, int start, int count)
Constructor
ByteArray(int size)
Constructor that creates a byte array of the specified size.
Public Methods
byte[] getBytes()
Returns the internal byte array.
int getCount()
Returns the count of bytes
byte[] getNewBytes()
Returns a new byte array that is a copy of the data.
int getStart()
Returns the start position
void grow(int incr)
Grow the byte array by incr bytes.
void setCount(int count)
Set the count of bytes.
ByteArrayInputStream toByteArrayInputStream()
Returns a ByteArrayInputStream.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private byte[] bytes

private int count

private int start

Public Constructors

public ByteArray (byte[] b, int start, int count)

Constructor

Parameters
b
start
count

public ByteArray (int size)

Constructor that creates a byte array of the specified size.

Parameters
size

Public Methods

public byte[] getBytes ()

Returns the internal byte array. Note that this is a live reference to the actual data, not a copy.

public int getCount ()

Returns the count of bytes

public byte[] getNewBytes ()

Returns a new byte array that is a copy of the data.

public int getStart ()

Returns the start position

public void grow (int incr)

Grow the byte array by incr bytes.

Parameters
incr

public void setCount (int count)

Set the count of bytes.

Parameters
count

public ByteArrayInputStream toByteArrayInputStream ()

Returns a ByteArrayInputStream.