|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jkristian.lang.ByteArraySequence
public class ByteArraySequence
A ByteSequence that simply contains an array of bytes. The array is referenced, not copied; so changes to the array are visible via the containing object.
Constructor Summary | |
---|---|
ByteArraySequence(byte[] data)
|
Method Summary | |
---|---|
byte |
byteAt(int index)
|
static ByteArraySequence |
copy(byte[] data)
Copy the given data into a new ByteArraySequence. |
static ByteArraySequence |
copy(byte[] data,
int start,
int end)
Copy the given data into a new ByteArraySequence. |
static ByteArraySequence |
copy(ByteSequence data)
Copy the given data into a new ByteArraySequence. |
static ByteArraySequence |
copy(ByteSequence data,
int start,
int end)
Copy the given data into a new ByteArraySequence. |
void |
copy(int start,
int end,
byte[] into)
Copy a sub-sequence into a given array. |
void |
copy(int start,
int end,
byte[] into,
int intoStart)
Copy a sub-sequence into a given array. |
boolean |
equals(java.lang.Object that)
|
int |
hashCode()
|
int |
length()
|
ByteSequence |
subSequence(int start,
int end)
Create a read-only view of this sequence. |
byte[] |
toByteArray()
Copy this sequence into a new array. |
byte[] |
toByteArray(int start,
int end)
Copy a sub-sequence into a new array. |
java.lang.String |
toString()
|
java.lang.String |
toString(int start,
int end,
java.lang.String encoding)
new String(toByteArray(start, end), encoding) |
java.lang.String |
toString(java.lang.String encoding)
toString(0, length(), encoding) |
void |
writeTo(int start,
int end,
java.io.OutputStream out)
Copy a sub-sequence into an OutputStream. |
void |
writeTo(java.io.OutputStream out)
Copy this sequence into an OutputStream. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ByteArraySequence(byte[] data)
Method Detail |
---|
public static ByteArraySequence copy(byte[] data)
copy(data, 0, data.length)
.
public static ByteArraySequence copy(byte[] data, int start, int end)
public static ByteArraySequence copy(ByteSequence data)
copy(data, 0, data.length())
.
public static ByteArraySequence copy(ByteSequence data, int start, int end)
public int length()
length
in interface ByteSequence
public byte byteAt(int index)
byteAt
in interface ByteSequence
public void copy(int start, int end, byte[] into)
ByteSequence
copy(start, end, into, 0)
.
copy
in interface ByteSequence
public void copy(int start, int end, byte[] into, int intoStart)
ByteSequence
copy
in interface ByteSequence
public byte[] toByteArray()
ByteSequence
toByteArray(0, length())
.
toByteArray
in interface ByteSequence
public byte[] toByteArray(int start, int end)
ByteSequence
toByteArray
in interface ByteSequence
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String encoding) throws java.io.UnsupportedEncodingException
ByteSequence
toString
in interface ByteSequence
java.io.UnsupportedEncodingException
public java.lang.String toString(int start, int end, java.lang.String encoding) throws java.io.UnsupportedEncodingException
ByteSequence
toString
in interface ByteSequence
java.io.UnsupportedEncodingException
public void writeTo(java.io.OutputStream out) throws java.io.IOException
ByteSequence
writeTo(0,
length(), out)
.
writeTo
in interface ByteSequence
java.io.IOException
public void writeTo(int start, int end, java.io.OutputStream out) throws java.io.IOException
ByteSequence
writeTo
in interface ByteSequence
java.io.IOException
public ByteSequence subSequence(int start, int end)
ByteSequence
The returned sequence shares this sequence's content; that is, any changes to the bytes in the given range of this sequence will be visible in the sub-sequence.
subSequence
in interface ByteSequence
public boolean equals(java.lang.Object that)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |