public class ByteSequence extends Object implements Serializable
| Constructor and Description |
|---|
ByteSequence(byte[] buff)
Allocates a new
ByteSequence so that it represents the sequence of
bytes currently contained in the byte array argument. |
ByteSequence(byte[] buff,
int offset,
int length)
Allocates a new
ByteSequence that contains characters from a subarray
of the byte array argument. |
| Modifier and Type | Method and Description |
|---|---|
ByteArrayInputStream |
asInputStream() |
byte[] |
buffer()
returns the byte buffer used by this instance
|
byte |
byteAt(int index) |
ByteSequence |
copy() |
int |
length() |
int |
offset()
returns the index of first byte in byte buffer
|
void |
set(byte[] buff,
int offset,
int length)
replaces the internal byte buffer with the given byte array.
|
ByteSequence |
slice(int offset) |
ByteSequence |
slice(int offset,
int length) |
byte[] |
toByteArray(boolean clone) |
ByteBuffer |
toByteBuffer() |
String |
toString() |
String |
toString(Charset charset) |
String |
toString(String charset) |
public ByteSequence(byte[] buff)
ByteSequence so that it represents the sequence of
bytes currently contained in the byte array argument. The
contents of the byte array are not copied;buff - value of the bytesequencepublic ByteSequence(byte[] buff,
int offset,
int length)
ByteSequence that contains characters from a subarray
of the byte array argument. The offset argument is the
index of the first byte of the subarray and the length
argument specifies the length of the subarray. The contents of the
subarray are not copied;buff - Array that is the source of bytesoffset - The initial offsetlength - The lengthIndexOutOfBoundsException - If the offset and length arguments index
bytes outside the bounds of the buff arraypublic void set(byte[] buff,
int offset,
int length)
buff - Array that is the source of bytesoffset - The initial offsetlength - The lengthpublic byte byteAt(int index)
public byte[] buffer()
public int offset()
public int length()
public ByteSequence slice(int offset)
public ByteSequence slice(int offset, int length)
public ByteBuffer toByteBuffer()
public byte[] toByteArray(boolean clone)
public ByteArrayInputStream asInputStream()
public String toString(String charset) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic ByteSequence copy()
Copyright © 2021. All rights reserved.