public final class ByteBufferSlice extends Object implements Slice
ByteBuffer.
This class is not thread-safe. Use big-endian to read number from buffer.
| 构造器和说明 |
|---|
ByteBufferSlice(ByteBuffer buffer) |
ByteBufferSlice(ByteBuffer buffer,
int offset,
int length) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object o) |
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.
|
int |
hashCode() |
int |
length()
Get length of this slice.
|
String |
toString() |
public ByteBufferSlice(ByteBuffer buffer)
public ByteBufferSlice(ByteBuffer buffer, int offset, int length)
public int length()
Slicepublic byte[] getRawArray()
SlicegetRawArray 在接口中 Slicepublic int getRawOffset()
SlicegetRawOffset 在接口中 Slicepublic byte getByte(int index)
Slicepublic short getShort(int index)
Slicepublic int get3BytesInt(int index)
Sliceget3BytesInt 在接口中 Sliceindex - the specified absolute index in this slicepublic int getInt(int index)
Slicepublic long getLong(int index)
Slicepublic float getFloat(int index)
Slicepublic double getDouble(int index)
Slicepublic void getBytes(int index,
byte[] destination,
int destinationIndex,
int length)
Slicepublic byte[] getBytes()
Slicepublic byte[] getBytes(int index,
int length)
Slicepublic void getBytes(int index,
ByteBuffer destination)
Sliceindex until the destination's position
reaches its limit.Copyright © 2019–2020 Alibaba Group Holding Limited. All rights reserved.