Class PacketReader

  • All Implemented Interfaces:
    Reader

    public class PacketReader
    extends Object
    implements Reader
    • Constructor Detail

      • PacketReader

        public PacketReader​(InputStream in,
                            Configuration conf,
                            MutableInt sequence)
        Constructor of standard socket MySQL packet stream reader.
        Parameters:
        in - stream
        conf - connection options
        sequence - current increment sequence
    • Method Detail

      • readPacket

        public org.mariadb.jdbc.client.ReadableByteBuf readPacket​(boolean reUsable)
                                                           throws IOException
        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)
        Specified by:
        readPacket in interface Reader
        Parameters:
        reUsable - if packet can use existing reusable buf to avoid creating array
        Returns:
        array packet.
        Throws:
        IOException - if socket exception occur.
      • readPacket

        public org.mariadb.jdbc.client.ReadableByteBuf readPacket​(boolean reUsable,
                                                                  boolean traceEnable)
                                                           throws IOException
        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)
        Specified by:
        readPacket in interface Reader
        Parameters:
        reUsable - if packet can use existing reusable buf to avoid creating array
        traceEnable - must trace packet.
        Returns:
        array packet.
        Throws:
        IOException - if socket exception occur.
      • setServerThreadId

        public void setServerThreadId​(Long serverThreadId,
                                      HostAddress hostAddress)
        Set server thread id.
        Specified by:
        setServerThreadId in interface Reader
        Parameters:
        serverThreadId - current server thread id.
        hostAddress - host information