Package org.mariadb.jdbc.client.socket

## Class PacketReader

- java.lang.Object
- - org.mariadb.jdbc.client.socket.PacketReader

    public class PacketReader
    extends Object

### Constructor Summary

Constructors
`PacketReader​(InputStream in, Configuration conf, org.mariadb.jdbc.util.MutableInt sequence)` Constructor of standard socket MySQL packet stream reader.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()`
`org.mariadb.jdbc.util.MutableInt` `getSequence()`
`org.mariadb.jdbc.client.ReadableByteBuf` `readPacket​(boolean reUsable)` Get next MySQL packet.
`org.mariadb.jdbc.client.ReadableByteBuf` `readPacket​(boolean reUsable, boolean traceEnable)` Get next MySQL packet.
`void` `setServerThreadId​(Long serverThreadId, HostAddress hostAddress)` Set server thread id.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PacketReader

    public PacketReader​(InputStream in,
                        Configuration conf,
                        org.mariadb.jdbc.util.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)

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)

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.

#### getSequence

    public org.mariadb.jdbc.util.MutableInt 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