类 SimplePacketReader
- java.lang.Object
-
- com.mysql.cj.protocol.a.SimplePacketReader
-
- 所有已实现的接口:
MessageReader<NativePacketHeader,NativePacketPayload>
public class SimplePacketReader extends Object implements MessageReader<NativePacketHeader,NativePacketPayload>
Simple implementation ofMessageReaderwhich handles the receiving of logical MySQL packets from the provided socket input stream. Multi-packets are handled outside of this reader.
-
-
字段概要
字段 修饰符和类型 字段 说明 protected RuntimeProperty<Integer>maxAllowedPacketprotected SocketConnectionsocketConnection
-
构造器概要
构造器 构造器 说明 SimplePacketReader(SocketConnection socketConnection, RuntimeProperty<Integer> maxAllowedPacket)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 bytegetMessageSequence()Get last message sequence number, as it was stored byMessageReader.readHeader().NativePacketHeaderprobeHeader()Read the next message header from server, possibly blocking indefinitely until the message is received, and cache it so that the nextMessageReader.readHeader()return the same header.NativePacketPayloadprobeMessage(Optional<NativePacketPayload> reuse, NativePacketHeader header)Read message from server into to the givenMessageinstance or into the new one if not present and cache it so that the nextMessageReader.readMessage(Optional, MessageHeader)return the same message.NativePacketHeaderreadHeader()Read the next message header from server, possibly blocking indefinitely until the message is received.NativePacketPayloadreadMessage(Optional<NativePacketPayload> reuse, NativePacketHeader header)Read message from server into to the givenMessageinstance or into the new one if not present.voidresetMessageSequence()Set stored message sequence number to 0.-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 com.mysql.cj.protocol.MessageReader
pushMessageListener, readMessage, start, stopAfterNextMessage, undecorate, undecorateAll
-
-
-
-
字段详细资料
-
socketConnection
protected SocketConnection socketConnection
-
maxAllowedPacket
protected RuntimeProperty<Integer> maxAllowedPacket
-
-
构造器详细资料
-
SimplePacketReader
public SimplePacketReader(SocketConnection socketConnection, RuntimeProperty<Integer> maxAllowedPacket)
-
-
方法详细资料
-
readHeader
public NativePacketHeader readHeader() throws IOException
从接口复制的说明:MessageReaderRead the next message header from server, possibly blocking indefinitely until the message is received.- 指定者:
readHeader在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 返回:
MessageHeaderof the next message- 抛出:
IOException- if an error occurs
-
probeHeader
public NativePacketHeader probeHeader() throws IOException
从接口复制的说明:MessageReaderRead the next message header from server, possibly blocking indefinitely until the message is received, and cache it so that the nextMessageReader.readHeader()return the same header.- 指定者:
probeHeader在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 返回:
MessageHeaderof the next message- 抛出:
IOException- if an error occurs
-
readMessage
public NativePacketPayload readMessage(Optional<NativePacketPayload> reuse, NativePacketHeader header) throws IOException
从接口复制的说明:MessageReaderRead message from server into to the givenMessageinstance or into the new one if not present. For asynchronous channel it synchronously reads the next message in the stream, blocking until the message is read fully. Could throw CJCommunicationsException wrapping anIOExceptionduring read or parse- 指定者:
readMessage在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 参数:
reuse-Messageobject to reuse. May be ignored by implementation.header-MessageHeaderinstance- 返回:
Messageinstance- 抛出:
IOException- if an error occurs
-
probeMessage
public NativePacketPayload probeMessage(Optional<NativePacketPayload> reuse, NativePacketHeader header) throws IOException
从接口复制的说明:MessageReaderRead message from server into to the givenMessageinstance or into the new one if not present and cache it so that the nextMessageReader.readMessage(Optional, MessageHeader)return the same message. For asynchronous channel it synchronously reads the next message in the stream, blocking until the message is read fully. Could throw CJCommunicationsException wrapping anIOExceptionduring read or parse- 指定者:
probeMessage在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 参数:
reuse-Messageobject to reuse. May be ignored by implementation.header-MessageHeaderinstance- 返回:
Messageinstance- 抛出:
IOException- if an error occurs
-
getMessageSequence
public byte getMessageSequence()
从接口复制的说明:MessageReaderGet last message sequence number, as it was stored byMessageReader.readHeader().- 指定者:
getMessageSequence在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 返回:
- number
-
resetMessageSequence
public void resetMessageSequence()
从接口复制的说明:MessageReaderSet stored message sequence number to 0.
-
-