类 SyncMessageReader
- java.lang.Object
-
- com.mysql.cj.protocol.x.SyncMessageReader
-
- 所有已实现的接口:
MessageReader<XMessageHeader,XMessage>
public class SyncMessageReader extends Object implements MessageReader<XMessageHeader,XMessage>
Synchronous-only implementation ofMessageReader. This implementation wraps aInputStream.
-
-
构造器概要
构造器 构造器 说明 SyncMessageReader(FullReadInputStream inputStream, Protocol.ProtocolEventHandler protocolEventHandler)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 intgetNextNonNoticeMessageType()voidpushMessageListener(MessageListener<XMessage> listener)Queue aMessageListenerto receive messages delivered asynchronously.XMessageHeaderreadHeader()Read the next message header from server, possibly blocking indefinitely until the message is received.XMessagereadMessage(Optional<XMessage> reuse, int expectedType)Read message from server into to the givenMessageinstance or into the new one if not present.XMessagereadMessage(Optional<XMessage> reuse, XMessageHeader hdr)Read message from server into to the givenMessageinstance or into the new one if not present.-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 com.mysql.cj.protocol.MessageReader
getMessageSequence, probeHeader, probeMessage, resetMessageSequence, start, stopAfterNextMessage, undecorate, undecorateAll
-
-
-
-
构造器详细资料
-
SyncMessageReader
public SyncMessageReader(FullReadInputStream inputStream, Protocol.ProtocolEventHandler protocolEventHandler)
-
-
方法详细资料
-
readHeader
public XMessageHeader readHeader() throws IOException
从接口复制的说明:MessageReaderRead the next message header from server, possibly blocking indefinitely until the message is received.- 指定者:
readHeader在接口中MessageReader<XMessageHeader,XMessage>- 返回:
MessageHeaderof the next message- 抛出:
IOException- if an error occurs
-
getNextNonNoticeMessageType
public int getNextNonNoticeMessageType() throws IOException- 抛出:
IOException
-
readMessage
public XMessage readMessage(Optional<XMessage> reuse, XMessageHeader hdr) 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<XMessageHeader,XMessage>- 参数:
reuse-Messageobject to reuse. May be ignored by implementation.hdr-MessageHeaderinstance- 返回:
Messageinstance- 抛出:
IOException- if an error occurs
-
readMessage
public XMessage readMessage(Optional<XMessage> reuse, int expectedType) 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 WrongArgumentException if the expected message type is not the next message (exception will be thrown in *caller* context).- 指定者:
readMessage在接口中MessageReader<XMessageHeader,XMessage>- 参数:
reuse-Messageobject to reuse. May be ignored by implementation.expectedType- Expected type of message.- 返回:
Messageinstance- 抛出:
IOException- if an error occurs
-
pushMessageListener
public void pushMessageListener(MessageListener<XMessage> listener)
从接口复制的说明:MessageReaderQueue aMessageListenerto receive messages delivered asynchronously.- 指定者:
pushMessageListener在接口中MessageReader<XMessageHeader,XMessage>- 参数:
listener-MessageListener
-
-