Package org.mariadb.jdbc.client.socket
Class PacketReader
java.lang.Object
org.mariadb.jdbc.client.socket.PacketReader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]
private final InputStream
private static final Logger
private static final int
private final int
private static final int
private final byte[]
private final MutableInt
private String
-
Constructor Summary
ConstructorsConstructorDescriptionPacketReader
(InputStream in, Configuration conf, MutableInt sequence) Constructor of standard socket MySQL packet stream reader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
readPacket
(boolean reUsable) Get next MySQL packet.readPacket
(boolean reUsable, boolean traceEnable) Get next MySQL packet.void
setServerThreadId
(Long serverThreadId, HostAddress hostAddress) Set server thread id.
-
Field Details
-
REUSABLE_BUFFER_LENGTH
private static final int REUSABLE_BUFFER_LENGTH- See Also:
-
MAX_PACKET_SIZE
private static final int MAX_PACKET_SIZE- See Also:
-
logger
-
header
private final byte[] header -
reusableArray
private final byte[] reusableArray -
inputStream
-
maxQuerySizeToLog
private final int maxQuerySizeToLog -
sequence
-
serverThreadLog
-
-
Constructor Details
-
PacketReader
Constructor of standard socket MySQL packet stream reader.- Parameters:
in
- streamconf
- connection optionssequence
- current increment sequence
-
-
Method Details
-
readPacket
Get 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
Get 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
-
close
- Throws:
IOException
-
setServerThreadId
Set server thread id.- Parameters:
serverThreadId
- current server thread id.hostAddress
- host information
-