类 CompressedPacketSender
- java.lang.Object
-
- com.mysql.cj.protocol.a.CompressedPacketSender
-
- 所有已实现的接口:
MessageSender<NativePacketPayload>
public class CompressedPacketSender extends Object implements MessageSender<NativePacketPayload>
AMessageSenderfor the compressed protocol. TODO: add support for pre-allocated buffer for large packets (if there's a demonstrable perf improvement)
-
-
字段概要
字段 修饰符和类型 字段 说明 static intCOMP_HEADER_LENGTHstatic intMIN_COMPRESS_LEN
-
构造器概要
构造器 构造器 说明 CompressedPacketSender(BufferedOutputStream outputStream)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidsend(byte[] packet, int packetLen, byte packetSequence)Packet sender implementation for the compressed MySQL protocol.voidstop()Shut down this packet sender and deallocate any resources.MessageSender<NativePacketPayload>undecorate()Return the previous PacketSender instance from the decorators chain or the current PacketSender if it is the first entry in a chain.MessageSender<NativePacketPayload>undecorateAll()Return a PacketSender instance free of decorators.-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 com.mysql.cj.protocol.MessageSender
send, send, setMaxAllowedPacket
-
-
-
-
构造器详细资料
-
CompressedPacketSender
public CompressedPacketSender(BufferedOutputStream outputStream)
-
-
方法详细资料
-
stop
public void stop()
Shut down this packet sender and deallocate any resources.
-
send
public void send(byte[] packet, int packetLen, byte packetSequence) throws IOExceptionPacket sender implementation for the compressed MySQL protocol. For compressed transmission of multi-packets, split the packets up in the same way as the uncompressed protocol. We fit up to MAX_PACKET_SIZE bytes of split uncompressed packet, including the header, into an compressed packet. The first packet of the multi-packet is 4 bytes of header and MAX_PACKET_SIZE - 4 bytes of the payload. The next packet must send the remaining four bytes of the payload followed by a new header and payload. If the second split packet is also around MAX_PACKET_SIZE in length, then only MAX_PACKET_SIZE - 4 (from the previous packet) - 4 (for the new header) can be sent. This means the payload will be limited by 8 bytes and this will continue to increase by 4 at every iteration.- 指定者:
send在接口中MessageSender<NativePacketPayload>- 参数:
packet- data bytespacketLen- packet lengthpacketSequence- sequence id- 抛出:
IOException- if i/o exception occurs
-
undecorateAll
public MessageSender<NativePacketPayload> undecorateAll()
从接口复制的说明:MessageSenderReturn a PacketSender instance free of decorators.- 指定者:
undecorateAll在接口中MessageSender<NativePacketPayload>- 返回:
MessageSenderinstance
-
undecorate
public MessageSender<NativePacketPayload> undecorate()
从接口复制的说明:MessageSenderReturn the previous PacketSender instance from the decorators chain or the current PacketSender if it is the first entry in a chain.- 指定者:
undecorate在接口中MessageSender<NativePacketPayload>- 返回:
MessageSenderinstance
-
-