Class MySQLPacketPayload
java.lang.Object
org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload
- All Implemented Interfaces:
AutoCloseable,PacketPayload
MySQL payload operation for MySQL packet data types.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intreadInt1()Read 1 byte fixed length integer from byte buffers.intreadInt2()Read 2 byte fixed length integer from byte buffers.intreadInt3()Read 3 byte fixed length integer from byte buffers.intreadInt4()Read 4 byte fixed length integer from byte buffers.longreadInt6()Read 6 byte fixed length integer from byte buffers.longreadInt8()Read 8 byte fixed length integer from byte buffers.longRead lenenc integer from byte buffers.longreadLong(int length) Read fixed length long from byte buffers.Read rest of packet string from byte buffers.byte[]Read rest of packet string from byte buffers and return bytes.readStringFix(int length) Read fixed length string from byte buffers.byte[]readStringFixByBytes(int length) Read fixed length string from byte buffers and return bytes.Read lenenc string from byte buffers.byte[]Read lenenc string from byte buffers for bytes.Read null terminated string from byte buffers.byte[]Read null terminated string from byte buffers and return bytes.Read variable length string from byte buffers.voidskipReserved(int length) Skip reserved from byte buffers.voidwriteBytes(byte[] value) Write variable length bytes to byte buffers.voidwriteBytesLenenc(byte[] value) Write lenenc bytes to byte buffers.voidwriteInt1(int value) Write 1 byte fixed length integer to byte buffers.voidwriteInt2(int value) Write 2 byte fixed length integer to byte buffers.voidwriteInt3(int value) Write 3 byte fixed length integer to byte buffers.voidwriteInt4(int value) Write 4 byte fixed length integer to byte buffers.voidwriteInt6(long value) Write 6 byte fixed length integer to byte buffers.voidwriteInt8(long value) Write 8 byte fixed length integer to byte buffers.voidwriteIntLenenc(long value) Write lenenc integer to byte buffers.voidwriteReserved(int length) Write null for reserved to byte buffers.voidwriteStringEOF(String value) Write rest of packet string to byte buffers.voidwriteStringFix(String value) Write variable length string to byte buffers.voidwriteStringLenenc(String value) Write lenenc string to byte buffers.voidwriteStringNul(String value) Write null terminated string to byte buffers.voidwriteStringVar(String value) Write fixed length string to byte buffers.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.shardingsphere.db.protocol.payload.PacketPayload
getByteBuf, getCharset
-
Constructor Details
-
MySQLPacketPayload
public MySQLPacketPayload()
-
-
Method Details
-
readInt1
public int readInt1()Read 1 byte fixed length integer from byte buffers.- Returns:
- 1 byte fixed length integer
- See Also:
-
writeInt1
public void writeInt1(int value) Write 1 byte fixed length integer to byte buffers.- Parameters:
value- 1 byte fixed length integer- See Also:
-
readInt2
public int readInt2()Read 2 byte fixed length integer from byte buffers.- Returns:
- 2 byte fixed length integer
- See Also:
-
writeInt2
public void writeInt2(int value) Write 2 byte fixed length integer to byte buffers.- Parameters:
value- 2 byte fixed length integer- See Also:
-
readInt3
public int readInt3()Read 3 byte fixed length integer from byte buffers.- Returns:
- 3 byte fixed length integer
- See Also:
-
writeInt3
public void writeInt3(int value) Write 3 byte fixed length integer to byte buffers.- Parameters:
value- 3 byte fixed length integer- See Also:
-
readInt4
public int readInt4()Read 4 byte fixed length integer from byte buffers.- Returns:
- 4 byte fixed length integer
- See Also:
-
writeInt4
public void writeInt4(int value) Write 4 byte fixed length integer to byte buffers.- Parameters:
value- 4 byte fixed length integer- See Also:
-
readInt6
public long readInt6()Read 6 byte fixed length integer from byte buffers.- Returns:
- 6 byte fixed length integer
- See Also:
-
writeInt6
public void writeInt6(long value) Write 6 byte fixed length integer to byte buffers.- Parameters:
value- 6 byte fixed length integer- See Also:
-
readInt8
public long readInt8()Read 8 byte fixed length integer from byte buffers.- Returns:
- 8 byte fixed length integer
- See Also:
-
writeInt8
public void writeInt8(long value) Write 8 byte fixed length integer to byte buffers.- Parameters:
value- 8 byte fixed length integer- See Also:
-
readIntLenenc
public long readIntLenenc()Read lenenc integer from byte buffers.- Returns:
- lenenc integer
- See Also:
-
writeIntLenenc
public void writeIntLenenc(long value) Write lenenc integer to byte buffers.- Parameters:
value- lenenc integer- See Also:
-
readLong
public long readLong(int length) Read fixed length long from byte buffers.- Parameters:
length- length read from byte buffers- Returns:
- fixed length long
-
readStringLenenc
Read lenenc string from byte buffers.- Returns:
- lenenc string
- See Also:
-
readStringLenencByBytes
public byte[] readStringLenencByBytes()Read lenenc string from byte buffers for bytes.- Returns:
- lenenc bytes
- See Also:
-
writeStringLenenc
Write lenenc string to byte buffers.- Parameters:
value- fixed length string- See Also:
-
writeBytesLenenc
public void writeBytesLenenc(byte[] value) Write lenenc bytes to byte buffers.- Parameters:
value- fixed length bytes
-
readStringFix
Read fixed length string from byte buffers.- Parameters:
length- length of fixed string- Returns:
- fixed length string
- See Also:
-
readStringFixByBytes
public byte[] readStringFixByBytes(int length) Read fixed length string from byte buffers and return bytes.- Parameters:
length- length of fixed string- Returns:
- fixed length bytes
- See Also:
-
writeStringFix
Write variable length string to byte buffers.- Parameters:
value- fixed length string- See Also:
-
writeBytes
public void writeBytes(byte[] value) Write variable length bytes to byte buffers.- Parameters:
value- fixed length bytes- See Also:
-
readStringVar
Read variable length string from byte buffers.- Returns:
- variable length string
- See Also:
-
writeStringVar
Write fixed length string to byte buffers.- Parameters:
value- variable length string- See Also:
-
readStringNul
Read null terminated string from byte buffers.- Returns:
- null terminated string
- See Also:
-
readStringNulByBytes
public byte[] readStringNulByBytes()Read null terminated string from byte buffers and return bytes.- Returns:
- null terminated bytes
- See Also:
-
writeStringNul
Write null terminated string to byte buffers.- Parameters:
value- null terminated string- See Also:
-
readStringEOFByBytes
public byte[] readStringEOFByBytes()Read rest of packet string from byte buffers and return bytes.- Returns:
- rest of packet string bytes
- See Also:
-
readStringEOF
Read rest of packet string from byte buffers.- Returns:
- rest of packet string
- See Also:
-
writeStringEOF
Write rest of packet string to byte buffers.- Parameters:
value- rest of packet string- See Also:
-
skipReserved
public void skipReserved(int length) Skip reserved from byte buffers.- Parameters:
length- length of reserved
-
writeReserved
public void writeReserved(int length) Write null for reserved to byte buffers.- Parameters:
length- length of reserved
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-