Package org.mariadb.jdbc.client.socket.impl

## Class PacketReader

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

All Implemented Interfaces:
  `Reader`

    public class PacketReader
    extends Object
    implements Reader

Packet reader

### Constructor Summary

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

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Close stream
`MutableInt` `getSequence()` Get current sequence object
`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,
                        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.

#### getSequence

    public MutableInt getSequence()

Description copied from interface: `Reader`
Get current sequence object

Specified by:
  `getSequence` in interface `Reader`
Returns:
  current sequence

#### close

    public void close()
               throws IOException

Description copied from interface: `Reader`
Close stream

Specified by:
  `close` in interface `Reader`
Throws:
  `IOException` - if any error occurs

#### 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