public class CmsByteBuffer
extends java.lang.Object
构造器和说明 |
---|
CmsByteBuffer()
Creates a new instance.
|
CmsByteBuffer(int capacity)
Creates a new instance with a given initial capacity.
|
限定符和类型 | 方法和说明 |
---|---|
int |
getCapacity()
Gets the current length of the internal byte buffer, which is the number of bytes this buffer
can contain before a new buffer is allocated.
|
void |
readBytes(byte[] dest,
int srcStart,
int destStart,
int len)
Transfers bytes from this buffer to a target byte array.
|
int |
size()
Returns the logical size of this buffer (which may be less than its capacity).
|
java.lang.String |
toString() |
void |
truncate(int size)
Changes the logical size of this buffer.
|
void |
writeBytes(byte[] src,
int srcStart,
int destStart,
int len)
Writes some bytes to this buffer, expanding the buffer if necessary.
|
public CmsByteBuffer()
public CmsByteBuffer(int capacity)
capacity
- the initial capacitypublic int getCapacity()
public void readBytes(byte[] dest, int srcStart, int destStart, int len)
dest
- the byte array to which the bytes should be transferredsrcStart
- the start index in this bufferdestStart
- the start index in the destination bufferlen
- the number of bytes to transferpublic int size()
public java.lang.String toString()
toString
在类中 java.lang.Object
Object.toString()
public void truncate(int size)
If the size is larger than the current size, the new space will be filled with 0s. Note that the internal byte buffer will not be shrunk if the size is smaller than the current size.
size
- the new sizepublic void writeBytes(byte[] src, int srcStart, int destStart, int len)
src
- the source from which to write the bytessrcStart
- the start index in the source arraydestStart
- the start index in this bufferlen
- the number of bytes to write