Top Description Fields Constructors Methods
com.sun.mail.iap

public Class ByteArray

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream

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

Field Summary

Modifier and TypeField and Description
private byte[]
private int
private int

Constructor Summary

AccessConstructor and Description
public
ByteArray(byte[]
the byte array to wrap
b
,
int
start position in byte array
start
,
int
number of bytes in byte array
count
)

Constructor

public
ByteArray(int
the size of the ByteArray
size
)

Constructor that creates a byte array of the specified size.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

the wrapped byte array
getBytes
()

Returns the internal byte array.

public int

Returns:

the number of bytes
getCount
()

Returns the count of bytes

public byte[]

Returns:

a new byte array with the bytes from start for count
getNewBytes
()

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

public int

Returns:

the start position
getStart
()

Returns the start position

public void
grow(int
how much to grow
incr
)

Grow the byte array by incr bytes.

public void
setCount(int
the number of bytes
count
)

Set the count of bytes.

public ByteArrayInputStream

Returns:

the ByteArrayInputStream
toByteArrayInputStream
()

Returns a ByteArrayInputStream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bytesback to summary
private byte[] bytes
countback to summary
private int count
startback to summary
private int start

Constructor Detail

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

Constructor

Parameters
b:byte[]

the byte array to wrap

start:int

start position in byte array

count:int

number of bytes in byte array

ByteArrayback to summary
public ByteArray(int size)

Constructor that creates a byte array of the specified size.

Parameters
size:int

the size of the ByteArray

Since
JavaMail 1.4.1

Method Detail

getBytesback to summary
public byte[] getBytes()

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

Returns:byte[]

the wrapped byte array

getCountback to summary
public int getCount()

Returns the count of bytes

Returns:int

the number of bytes

getNewBytesback to summary
public byte[] getNewBytes()

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

Returns:byte[]

a new byte array with the bytes from start for count

getStartback to summary
public int getStart()

Returns the start position

Returns:int

the start position

growback to summary
public void grow(int incr)

Grow the byte array by incr bytes.

Parameters
incr:int

how much to grow

Since
JavaMail 1.4.1
setCountback to summary
public void setCount(int count)

Set the count of bytes.

Parameters
count:int

the number of bytes

Since
JavaMail 1.4.1
toByteArrayInputStreamback to summary
public ByteArrayInputStream toByteArrayInputStream()

Returns a ByteArrayInputStream.

Returns:ByteArrayInputStream

the ByteArrayInputStream