|
ref_send API 2.17 defensive programming in Java |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.joe_e.array.ConstArray<E>
org.joe_e.array.ImmutableArray<E>
org.joe_e.array.PowerlessArray<java.lang.Byte>
org.joe_e.array.ByteArray
public final class ByteArray
An immutable array of byte.
| Nested Class Summary | |
|---|---|
static class |
ByteArray.Builder
A ByteArray factory. |
static class |
ByteArray.BuilderOutputStream
A ByteArray factory that extends OutputStream. |
| Method Summary | ||
|---|---|---|
static ByteArray |
array()
Construct an empty ByteArray |
|
static ByteArray |
array(byte... bytes)
Construct a ByteArray. |
|
static ByteArray |
array(byte value)
Construct a ByteArray with one element. |
|
static ByteArray |
array(byte value1,
byte value2)
Construct a ByteArray with two elements. |
|
static ByteArray |
array(byte value1,
byte value2,
byte value3)
Construct a ByteArray with three elements. |
|
static ByteArray |
array(byte value1,
byte value2,
byte value3,
byte value4)
Construct a ByteArray with four elements. |
|
java.io.InputStream |
asInputStream()
Views this array as an input stream. |
|
static ByteArray.Builder |
builder()
Get a ByteArray.Builder. |
|
static ByteArray.Builder |
builder(int estimate)
Get a ByteArray.Builder. |
|
boolean |
equals(java.lang.Object other)
Test for equality with another object |
|
java.lang.Byte |
get(int i)
Creates a Byte for a specified byte. |
|
byte |
getByte(int i)
Gets the byte at a specified position. |
|
int |
hashCode()
Computes a digest of the array for hashing. |
|
int |
length()
Gets the length of the array. |
|
|
toArray(T[] prototype)
Return a mutable copy of the array |
|
byte[] |
toByteArray()
Creates a mutable copy of the byte array |
|
java.lang.String |
toString()
Return a string representation of the array |
|
ByteArray |
with(byte newByte)
Creates a ByteArray with an appended byte. |
|
ByteArray |
with(java.lang.Byte newByte)
Creates a ByteArray with an appended Byte. |
|
ByteArray |
without(int i)
Return a new ByteArray that contains the same elements
as this one excluding the element at a specified index |
|
| Methods inherited from class org.joe_e.array.PowerlessArray |
|---|
array |
| Methods inherited from class org.joe_e.array.ConstArray |
|---|
iterator |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static ByteArray array(byte... bytes)
ByteArray.
bytes - each bytepublic static ByteArray array()
ByteArray
public static ByteArray array(byte value)
ByteArray with one element.
value - the value
public static ByteArray array(byte value1,
byte value2)
ByteArray with two elements.
value1 - the first valuevalue2 - the second value
public static ByteArray array(byte value1,
byte value2,
byte value3)
ByteArray with three elements.
value1 - the first valuevalue2 - the second valuevalue3 - the third value
public static ByteArray array(byte value1,
byte value2,
byte value3,
byte value4)
ByteArray with four elements.
value1 - the first valuevalue2 - the second valuevalue3 - the third valuevalue4 - the fourth valuepublic boolean equals(java.lang.Object other)
equals in class ImmutableArray<java.lang.Byte>ConstArray with the same
contents as this arraypublic int hashCode()
Arrays.hashCode(Object[]) called on a Java array
containing the same elements.
hashCode in interface SelflesshashCode in class ConstArray<java.lang.Byte>public java.lang.String toString()
toString in class ConstArray<java.lang.Byte>public int length()
length in class ConstArray<java.lang.Byte>public java.lang.Byte get(int i)
Byte for a specified byte.
get in class ConstArray<java.lang.Byte>i - position of the byte to return
java.lang.ArrayIndexOutOfBoundsException - i is out of boundspublic <T> T[] toArray(T[] prototype)
toArray in class ConstArray<java.lang.Byte>prototype - prototype of the array to copy into
ConstArray
of the same type as prototype
java.lang.ArrayStoreException - if an element cannot be stored in the arraypublic ByteArray with(java.lang.Byte newByte)
ByteArray with an appended Byte.
with in class PowerlessArray<java.lang.Byte>newByte - the element to append
java.lang.NullPointerException - newByte is nullpublic byte getByte(int i)
byte at a specified position.
i - position of the byte to return
java.lang.ArrayIndexOutOfBoundsException - i is out of boundspublic byte[] toByteArray()
byte array
public ByteArray with(byte newByte)
ByteArray with an appended byte.
newByte - the byte to appendpublic java.io.InputStream asInputStream()
public ByteArray without(int i)
ByteArray that contains the same elements
as this one excluding the element at a specified index
without in class PowerlessArray<java.lang.Byte>i - the index of the element to exclude
public static ByteArray.Builder builder()
ByteArray.Builder. This is equivalent to the
constructor.
public static ByteArray.Builder builder(int estimate)
ByteArray.Builder. This is equivalent to the
constructor.
estimate - estimated array length
|
ref_send API 2.17 defensive programming in Java |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.