org.mariadb.jdbc.internal.packet.read

## Class ReadPacketFetcher

- java.lang.Object
- - org.mariadb.jdbc.internal.packet.read.ReadPacketFetcher

    public class ReadPacketFetcher
    extends Object

### Field Summary

Fields
`static int` `AVOID_CREATE_BUFFER_LENGTH`

### Constructor Summary

Constructors
Constructor and Description
`ReadPacketFetcher(InputStream is)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()`
`InputStream` `getInputStream()`
`int` `getLastPacketSeq()`
`Buffer` `getPacket()` Get buffer packet.
`int` `getPacketLength()` Get next packet length.
`Buffer` `getReusableBuffer()` Get buffer with shared array.
`Buffer` `getReusableBuffer(int length)` Get buffer with shared array of designated length.
`byte[]` `readLength(int length)` Read buffer without reading the length packet first.

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

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

### Field Detail

#### AVOID_CREATE_BUFFER_LENGTH

    public static final int AVOID_CREATE_BUFFER_LENGTH

See Also:
  Constant Field Values

### Constructor Detail

#### ReadPacketFetcher

    public ReadPacketFetcher(InputStream is)

### Method Detail

#### getPacketLength

    public int getPacketLength()
                        throws IOException

Get next packet length.

Returns:
  the length of the next packet
Throws:
  `IOException` - if any

#### getPacket

    public Buffer getPacket()
                     throws IOException

Get buffer packet.

Returns:
  Buffer the buffer
Throws:
  `IOException` - if any

#### getReusableBuffer

    public Buffer getReusableBuffer(int length)
                             throws IOException

Get buffer with shared array of designated length.

Parameters:
  `length` - length to read
Returns:
  Buffer the buffer
Throws:
  `IOException` - if any

#### getReusableBuffer

    public Buffer getReusableBuffer()
                             throws IOException

Get buffer with shared array.

Returns:
  Buffer the buffer
Throws:
  `IOException` - if any

#### getLastPacketSeq

    public int getLastPacketSeq()

#### close

    public void close()
               throws IOException

Throws:
  `IOException`

#### getInputStream

    public InputStream getInputStream()

#### readLength

    public byte[] readLength(int length)
                      throws IOException

Read buffer without reading the length packet first.

Parameters:
  `length` - data to read
Returns:
  byte array the de desired length
Throws:
  `IOException` - if any error occur