public interface Slice
| 限定符和类型 | 方法和说明 |
|---|---|
int |
get3BytesInt(int index)
Get a 24-bit integer in the slice.
|
byte |
getByte(int index)
Get a byte in the slice.
|
byte[] |
getBytes()
Get byte array of the slice.
|
void |
getBytes(int index,
byte[] destination,
int destinationIndex,
int length)
Transfer this array or buffer to a byte array.
|
void |
getBytes(int index,
ByteBuffer destination)
Transfer this buffer's data to the specified destination starting at
the specified absolute
index until the destination's position
reaches its limit. |
byte[] |
getBytes(int index,
int length)
Get sub-region byte array of the slice.
|
double |
getDouble(int index)
Get 8 bytes double in the slice.
|
float |
getFloat(int index)
Get 4 bytes float in the slice.
|
int |
getInt(int index)
Get a 32-bit integer in the slice.
|
long |
getLong(int index)
Get a 64-bit long integer in the slice.
|
byte[] |
getRawArray()
Get the raw array of the slice.
|
int |
getRawOffset()
Get the offset of the slice.
|
short |
getShort(int index)
Get a 16-bit short integer in the slice.
|
default SliceInput |
input()
Create an input stream for this slice.
|
int |
length()
Get length of this slice.
|
int length()
byte[] getRawArray()
int getRawOffset()
byte getByte(int index)
index - the specified absolute index in this sliceIndexOutOfBoundsException - if the specified index is less than 0 or
index + 1 is greater than capacityshort getShort(int index)
index - the specified absolute index in this sliceIndexOutOfBoundsException - if the specified index is less than 0 or
index + 2 is greater than capacityint get3BytesInt(int index)
index - the specified absolute index in this sliceIndexOutOfBoundsException - if the specified index is less than 0 or
index + 3 is greater than capacityint getInt(int index)
index - the specified absolute index in this slice.IndexOutOfBoundsException - if the specified index is less than 0 or
index + 4 is greater than capacitylong getLong(int index)
index - the specified absolute index in this sliceIndexOutOfBoundsException - if the specified index is less than 0 or
index + 8 is greater than capacityfloat getFloat(int index)
index - the specified absolute index in this sliceIndexOutOfBoundsException - if the specified index is less than 0 or
index + 8 is greater than capacitydouble getDouble(int index)
index - the specified absolute index in this sliceIndexOutOfBoundsException - if the specified index is less than 0 or
index + 8 is greater than capacityvoid getBytes(int index,
byte[] destination,
int destinationIndex,
int length)
index - the specified absolute index in this slicedestination - destination byte arraydestinationIndex - the first index of the destinationlength - the number of bytes to transferIndexOutOfBoundsException - if the specified index is less than 0,
if the specified dstIndex is less than 0,
if index + length is greater than
this.capacity, or
if dstIndex + length is greater than
dst.lengthbyte[] getBytes()
byte[] getBytes(int index,
int length)
index - the specified absolute index in this slicelength - lengthvoid getBytes(int index,
ByteBuffer destination)
index until the destination's position
reaches its limit.index - the specified absolute index in this slicedestination - destination byte bufferIndexOutOfBoundsException - if the specified index is less than 0 or
if index + dst.remaining() is greater than
this.capacitydefault SliceInput input()
Copyright © 2019–2020 Alibaba Group Holding Limited. All rights reserved.