|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.joe_e.array.ConstArray<E> org.joe_e.array.ImmutableArray<E> org.joe_e.array.PowerlessArray<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. |
|
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(Object other)
Test for equality with another object |
|
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 |
|
String |
toString()
Return a string representation of the array |
|
ByteArray |
with(byte newByte)
Creates a ByteArray with an appended byte . |
|
ByteArray |
with(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 |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static ByteArray array(byte... bytes)
ByteArray
.
bytes
- each byte
public static ByteArray array()
ByteArray
public static ByteArray array(byte value)
ByteArray
with one element.
value
- the valuepublic static ByteArray array(byte value1, byte value2)
ByteArray
with two elements.
value1
- the first valuevalue2
- the second valuepublic static ByteArray array(byte value1, byte value2, byte value3)
ByteArray
with three elements.
value1
- the first valuevalue2
- the second valuevalue3
- the third valuepublic 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(Object other)
equals
in class ConstArray<Byte>
other
- the reference object with which to compare.
ConstArray
with the same
contents as this arrayObject.hashCode()
,
HashMap
public int hashCode()
Arrays.hashCode(Object[])
called on a Java array
containing the same elements.
hashCode
in interface Selfless
hashCode
in class ConstArray<Byte>
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
toString
in class ConstArray<Byte>
public int length()
length
in class ConstArray<Byte>
public Byte get(int i)
Byte
for a specified byte
.
get
in class ConstArray<Byte>
i
- position of the byte
to return
ArrayIndexOutOfBoundsException
- i
is out of boundspublic <T> T[] toArray(T[] prototype)
toArray
in class ConstArray<Byte>
prototype
- prototype of the array to copy into
ConstArray
of the same type as prototype
ArrayStoreException
- if an element cannot be stored in the arraypublic ByteArray with(Byte newByte)
ByteArray
with an appended Byte
.
with
in class PowerlessArray<Byte>
newByte
- the element to append
NullPointerException
- newByte
is nullpublic byte getByte(int i)
byte
at a specified position.
i
- position of the byte
to return
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 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<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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |