Class DecompressPacketInputStream

    • Field Detail

      • REUSABLE_BUFFER_LENGTH

        private static final int REUSABLE_BUFFER_LENGTH
        See Also:
        Constant Field Values
      • logger

        private static final Logger logger
      • header

        private final byte[] header
      • reusableArray

        private final byte[] reusableArray
      • inputStream

        private final java.io.InputStream inputStream
      • maxQuerySizeToLog

        private final int maxQuerySizeToLog
      • cacheData

        private byte[] cacheData
      • cachePos

        private int cachePos
      • cacheEnd

        private int cacheEnd
      • packetSeq

        private int packetSeq
      • compressPacketSeq

        private int compressPacketSeq
      • serverThreadLog

        private java.lang.String serverThreadLog
      • threadId

        private long threadId
    • Constructor Detail

      • DecompressPacketInputStream

        public DecompressPacketInputStream​(java.io.InputStream in,
                                           int maxQuerySizeToLog,
                                           long threadId)
    • Method Detail

      • getPacket

        public Buffer getPacket​(boolean reUsable)
                         throws java.io.IOException
        Specified by:
        getPacket in interface PacketInputStream
        Throws:
        java.io.IOException
      • getPacketArray

        public byte[] getPacketArray​(boolean reUsable)
                              throws java.io.IOException
        Get next packet. Packet can be compressed, and if so, can contain many standard packet.
        Specified by:
        getPacketArray in interface PacketInputStream
        Parameters:
        reUsable - if can use existing reusable buffer to avoid creating array
        Returns:
        array packet.
        Throws:
        java.io.IOException - if socket exception occur.
      • readCompressBlocking

        private void readCompressBlocking​(byte[] arr,
                                          int compressedLength,
                                          int decompressedLength)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • readBlocking

        private void readBlocking​(byte[] arr,
                                  int length)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • cache

        private void cache​(byte[] rawBytes,
                           int length)
      • getNextCachePacket

        private byte[] getNextCachePacket()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface PacketInputStream
        Throws:
        java.io.IOException
      • setServerThreadId

        public void setServerThreadId​(long serverThreadId,
                                      java.lang.Boolean isMaster)
        Set server thread id.
        Specified by:
        setServerThreadId in interface PacketInputStream
        Parameters:
        serverThreadId - current server thread id.
        isMaster - is server master