Package org.mariadb.jdbc.client.socket
Class PacketReader
- java.lang.Object
-
- org.mariadb.jdbc.client.socket.PacketReader
-
public class PacketReader extends Object
-
-
Constructor Summary
Constructors Constructor Description PacketReader(InputStream in, Configuration conf, org.mariadb.jdbc.util.MutableInt sequence)Constructor of standard socket MySQL packet stream reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()org.mariadb.jdbc.util.MutableIntgetSequence()org.mariadb.jdbc.client.ReadableByteBufreadPacket(boolean reUsable)Get next MySQL packet.org.mariadb.jdbc.client.ReadableByteBufreadPacket(boolean reUsable, boolean traceEnable)Get next MySQL packet.voidsetServerThreadId(Long serverThreadId, HostAddress hostAddress)Set server thread id.
-
-
-
Constructor Detail
-
PacketReader
public PacketReader(InputStream in, Configuration conf, org.mariadb.jdbc.util.MutableInt sequence)
Constructor of standard socket MySQL packet stream reader.- Parameters:
in- streamconf- connection optionssequence- current increment sequence
-
-
Method Detail
-
readPacket
public org.mariadb.jdbc.client.ReadableByteBuf readPacket(boolean reUsable) throws IOExceptionGet next MySQL packet. If packet is more than 16M, read as many packet needed to finish reading MySQL packet. (first that has not length = 16Mb)- Parameters:
reUsable- if packet can use existing reusable buf to avoid creating array- Returns:
- array packet.
- Throws:
IOException- if socket exception occur.
-
readPacket
public org.mariadb.jdbc.client.ReadableByteBuf readPacket(boolean reUsable, boolean traceEnable) throws IOExceptionGet next MySQL packet. If packet is more than 16M, read as many packet needed to finish reading MySQL packet. (first that has not length = 16Mb)- Parameters:
reUsable- if packet can use existing reusable buf to avoid creating arraytraceEnable- must trace packet.- Returns:
- array packet.
- Throws:
IOException- if socket exception occur.
-
getSequence
public org.mariadb.jdbc.util.MutableInt getSequence()
-
close
public void close() throws IOException- Throws:
IOException
-
setServerThreadId
public void setServerThreadId(Long serverThreadId, HostAddress hostAddress)
Set server thread id.- Parameters:
serverThreadId- current server thread id.hostAddress- host information
-
-