Class Reader

java.lang.Object
org.mariadb.jdbc.client.socket.Reader

public class Reader extends Object
Packet reader
  • Constructor Details

    • Reader

      public Reader(InputStream in, Configuration conf, MutableByte sequence)
      Constructor of standard socket MySQL packet stream reader.
      Parameters:
      in - stream
      conf - connection options
      sequence - current increment sequence
  • Method Details

    • readableBufFromArray

      public org.mariadb.jdbc.client.ReadableByteBuf readableBufFromArray(byte[] buf)
    • readReusablePacket

      public org.mariadb.jdbc.client.ReadableByteBuf readReusablePacket() throws IOException
      Throws:
      IOException
    • readReusablePacket

      public org.mariadb.jdbc.client.ReadableByteBuf readReusablePacket(boolean traceEnable) throws IOException
      Throws:
      IOException
    • readPacket

      public byte[] readPacket(boolean traceEnable) throws IOException
      Get the next MySQL packet. If the packet is more than 16M, read as many packets needed to finish reading MySQL packet. (first that has no length = 16Mb)
      Parameters:
      traceEnable - must trace packet.
      Returns:
      array packet.
      Throws:
      IOException - if socket exception occur.
    • setMaxAllowedPacket

      public void setMaxAllowedPacket(Integer maxAllowedPacket)
      Set the maximum size (in bytes) of a packet the reader will accept. Called once the handshake/authentication phase is over to raise the limit from the 1Mb connection-phase cap to the configured maxAllowedPacket.
      Parameters:
      maxAllowedPacket - maximum received packet size, or null to use the default heap-relative ceiling
    • getSequence

      public MutableByte getSequence()
    • close

      public void close() throws IOException
      Throws:
      IOException
    • setServerThreadId

      public void setServerThreadId(Long serverThreadId, HostAddress hostAddress)
      Set server thread id.
      Parameters:
      serverThreadId - current server thread id.
      hostAddress - host information