Package org.mariadb.jdbc.client.socket

## Interface Reader

    public interface Reader

Packet Reader

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `close()` Close stream
`MutableByte` `getSequence()` Get current sequence object
`org.mariadb.jdbc.client.ReadableByteBuf` `readableBufFromArray​(byte[] buf)` Get a readable byte array from byte array.
`byte[]` `readPacket​(boolean traceEnable)` Get next MySQL packet.
`org.mariadb.jdbc.client.ReadableByteBuf` `readReusablePacket()` Get next MySQL packet.
`org.mariadb.jdbc.client.ReadableByteBuf` `readReusablePacket​(boolean traceEnable)` Get next MySQL packet.
`void` `setServerThreadId​(Long serverThreadId, HostAddress hostAddress)` Set server thread id.
`void` `skipPacket()` Skip next MySQL packet.

### Method Detail

#### readReusablePacket

    org.mariadb.jdbc.client.ReadableByteBuf readReusablePacket​(boolean traceEnable)
                                                        throws IOException

Get next MySQL packet. Packet is expected to have size < 16M and will use if possible an internal cached buffer. This packet bytes are expect to be read immediately

Parameters:
  `traceEnable` - must trace pacjet
Returns:
  Readable byte array packet.
Throws:
  `IOException` - if socket exception occur.

#### readReusablePacket

    org.mariadb.jdbc.client.ReadableByteBuf readReusablePacket()
                                                        throws IOException

Get next MySQL packet. Packet is expected to have size < 16M and will use if possible an internal cached buffer. This packet bytes are expect to be read immediately

Returns:
  Readable byte array packet.
Throws:
  `IOException` - if socket exception occur.

#### readPacket

    byte[] readPacket​(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:
  `traceEnable` - must trace packet.
Returns:
  array packet.
Throws:
  `IOException` - if socket exception occur.

#### readableBufFromArray

    org.mariadb.jdbc.client.ReadableByteBuf readableBufFromArray​(byte[] buf)

Get a readable byte array from byte array. This packet is expected to be read immediately, since no lock is set on this packet.

Parameters:
  `buf` - byte array to be parsed
Returns:
  array packet.

#### skipPacket

    void skipPacket()
             throws IOException

Skip next MySQL packet. Packet is expected to have size < 16M

Throws:
  `IOException` - if socket exception occur.

#### getSequence

    MutableByte getSequence()

Get current sequence object

Returns:
  current sequence

#### close

    void close()
        throws IOException

Close stream

Throws:
  `IOException` - if any error occurs

#### setServerThreadId

    void setServerThreadId​(Long serverThreadId,
                           HostAddress hostAddress)

Set server thread id.

Parameters:
  `serverThreadId` - current server thread id.
  `hostAddress` - host information