public class Buffer extends Object
Constructor and Description |
---|
Buffer(byte[] buf)
Constructor with default limit and offset.
|
Buffer(byte[] buf,
int limit) |
Modifier and Type | Method and Description |
---|---|
byte |
getByte()
Read current buffer byte without incrementing position.
|
byte |
getByteAt(int position) |
Buffer |
getLengthEncodedBuffer()
Get next data bytes from length encoded prefix.
|
byte[] |
getLengthEncodedBytes()
Get next data bytes with length encoded prefix.
|
long |
getLengthEncodedNumeric()
Get next binary data length.
|
int |
read24bitword()
Read 24 bit integer.
|
byte |
readByte()
Reads a byte from the buffer.
|
byte[] |
readBytesNullEnd()
Reads a byte array from the buffer, looks for a 0 to end the array.
|
int |
readInt()
Read a int (4 bytes) from the buffer.
|
long |
readLong()
Read a long (8 bytes) from the buffer.
|
byte[] |
readRawBytes(int numberOfBytes)
Read raw data.
|
short |
readShort()
Read a short (2 bytes) from the buffer.
|
String |
readString(int numberOfBytes)
Read String with defined length.
|
String |
readStringLengthEncoded(Charset charset)
Reads length-encoded string.
|
String |
readStringNullEnd(Charset charset)
Reads a string from the buffer, looks for a 0 to end the string.
|
int |
remaining() |
void |
skipByte() |
void |
skipBytes(int bytesToSkip) |
void |
skipLengthEncodedBytes()
Skip next length encode binary data.
|
void |
skipLengthEncodedNumeric()
Skip length encoded numeric
|
void |
writeBytes(byte header,
byte[] bytes)
Write bytes.
|
void |
writeLength(long length)
Write length.
|
void |
writeStringLength(byte[] bytes)
Write value with length encoded prefix.
|
void |
writeStringLength(String value)
Write value with length encoded prefix.
|
void |
writeStringSmallLength(byte[] value)
Write value with length encoded prefix. value length MUST be less than 251 char
|
public Buffer(byte[] buf, int limit)
public Buffer(byte[] buf)
buf
- byte arraypublic int remaining()
public String readStringNullEnd(Charset charset)
charset
- the charset to use, for example ASCIIpublic byte[] readBytesNullEnd()
public String readStringLengthEncoded(Charset charset)
charset
- the charset to use, for example ASCIIpublic String readString(int numberOfBytes)
numberOfBytes
- raw data length.public short readShort()
public int read24bitword()
public int readInt()
public long readLong()
public byte readByte()
public byte getByte()
public byte[] readRawBytes(int numberOfBytes)
numberOfBytes
- raw data length.public void skipByte()
public void skipBytes(int bytesToSkip)
public void skipLengthEncodedBytes()
public long getLengthEncodedNumeric()
public void skipLengthEncodedNumeric()
public Buffer getLengthEncodedBuffer()
public byte[] getLengthEncodedBytes()
public byte getByteAt(int position)
public void writeStringLength(String value)
value
- value to writepublic void writeStringLength(byte[] bytes)
bytes
- value to writepublic void writeStringSmallLength(byte[] value)
value
- value to writepublic void writeBytes(byte header, byte[] bytes)
header
- header bytebytes
- command bytespublic void writeLength(long length)
length
- lengthCopyright © 2020 mariadb.com. All rights reserved.