|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ByteSequence
A readable sequence of bytes. This is like a CharSequence, except the elements are bytes instead of chars.
This interface does not refine the general contracts of the equals and hashCode methods. But implementors are strongly encouraged to re-use ByteSequenceHelper.equals and hashCode, thereby making it possible to compare ByteSequences and use immutable ByteSequences as Map keys.
Method Summary | |
---|---|
byte |
byteAt(int index)
|
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. |
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(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. |
Method Detail |
---|
int length()
byte byteAt(int index)
byte[] toByteArray()
toByteArray(0, length())
.
byte[] toByteArray(int start, int end)
void copy(int start, int end, byte[] into)
copy(start, end, into, 0)
.
void copy(int start, int end, byte[] into, int intoStart)
java.lang.String toString(java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
java.lang.String toString(int start, int end, java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
void writeTo(java.io.OutputStream out) throws java.io.IOException
writeTo(0,
length(), out)
.
java.io.IOException
void writeTo(int start, int end, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
ByteSequence subSequence(int start, int end)
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |