org.mariadb.jdbc.internal.common.packet

## Class PacketOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.mariadb.jdbc.internal.common.packet.PacketOutputStream

All Implemented Interfaces:
  Closeable, Flushable, AutoCloseable

    public class PacketOutputStream
    extends OutputStream

### Field Summary

Fields
`ByteBuffer` `buffer`

### Constructor Summary

Constructors
Constructor and Description
`PacketOutputStream(OutputStream outputStream)`

### Method Summary

All Methods Instance Methods Concrete Methods
`PacketOutputStream` `assureBufferCapacity(int len)`
`void` `close()`
`void` `finishPacket()`
`void` `flush()`
`protected void` `increase(int newCapacity)`
`void` `sendFile(InputStream is, int seq)`
`void` `sendStream(InputStream is, long readLength, MySQLCharset charset)`
`void` `sendStream(InputStream is, MySQLCharset charset)`
`void` `sendStream(Reader reader, long readLength, MySQLCharset charset)`
`void` `sendStream(Reader reader, MySQLCharset charset)`
`void` `setMaxAllowedPacket(int maxAllowedPacket)`
`void` `setUseCompression(boolean useCompression)`
`void` `startPacket(int seqNo)`
`void` `startPacket(int seqNo, boolean checkPacketLength)`
`void` `write(byte[] bytes)`
`void` `write(byte[] b, int off, int len)`
`void` `write(int b)`
`PacketOutputStream` `writeByte(byte theByte)`
`PacketOutputStream` `writeByteArray(byte[] bytes)`
`PacketOutputStream` `writeByteArrayLength(byte[] bytes)`
`PacketOutputStream` `writeBytes(byte theByte, int count)`
`PacketOutputStream` `writeDateLength(Calendar calendar)`
`void` `writeEmptyPacket(int seqNo)`
`PacketOutputStream` `writeFieldLength(long length)`
`PacketOutputStream` `writeInt(int theInt)`
`PacketOutputStream` `writeLong(long theLong)`
`PacketOutputStream` `writeShort(short theShort)`
`PacketOutputStream` `writeString(String str)`
`PacketOutputStream` `writeStringLength(String str)`
`PacketOutputStream` `writeTimeLength(Calendar calendar, boolean fractionalSeconds)`
`PacketOutputStream` `writeTimestampLength(Calendar calendar, Timestamp ts)`

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

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

### Field Detail

#### buffer

    public ByteBuffer buffer

### Constructor Detail

#### PacketOutputStream

    public PacketOutputStream(OutputStream outputStream)

### Method Detail

#### increase

    protected void increase(int newCapacity)

#### setUseCompression

    public void setUseCompression(boolean useCompression)

#### startPacket

    public void startPacket(int seqNo,
                            boolean checkPacketLength)
                     throws IOException

Throws:
  `IOException`

#### startPacket

    public void startPacket(int seqNo)
                     throws IOException

Throws:
  `IOException`

#### writeEmptyPacket

    public void writeEmptyPacket(int seqNo)
                          throws IOException

Throws:
  `IOException`

#### sendFile

    public void sendFile(InputStream is,
                         int seq)
                  throws IOException

Throws:
  `IOException`

#### sendStream

    public void sendStream(InputStream is,
                           MySQLCharset charset)
                    throws IOException

Throws:
  `IOException`

#### sendStream

    public void sendStream(InputStream is,
                           long readLength,
                           MySQLCharset charset)
                    throws IOException

Throws:
  `IOException`

#### sendStream

    public void sendStream(Reader reader,
                           MySQLCharset charset)
                    throws IOException

Throws:
  `IOException`

#### sendStream

    public void sendStream(Reader reader,
                           long readLength,
                           MySQLCharset charset)
                    throws IOException

Throws:
  `IOException`

#### finishPacket

    public void finishPacket()
                      throws IOException

Throws:
  `IOException`

#### write

    public void write(byte[] b,
                      int off,
                      int len)
               throws IOException

Overrides:
  `write` in class `OutputStream`
Throws:
  `IOException`

#### flush

    public void flush()
               throws IOException

Specified by:
  `flush` in interface `Flushable`
Overrides:
  `flush` in class `OutputStream`
Throws:
  `IOException`

#### write

    public void write(byte[] bytes)
               throws IOException

Overrides:
  `write` in class `OutputStream`
Throws:
  `IOException`

#### write

    public void write(int b)
               throws IOException

Specified by:
  `write` in class `OutputStream`
Throws:
  `IOException`

#### close

    public void close()
               throws IOException

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Overrides:
  `close` in class `OutputStream`
Throws:
  `IOException`

#### setMaxAllowedPacket

    public void setMaxAllowedPacket(int maxAllowedPacket)

#### assureBufferCapacity

    public PacketOutputStream assureBufferCapacity(int len)

#### writeByte

    public PacketOutputStream writeByte(byte theByte)

#### writeBytes

    public PacketOutputStream writeBytes(byte theByte,
                                         int count)

#### writeByteArray

    public PacketOutputStream writeByteArray(byte[] bytes)

#### writeByteArrayLength

    public PacketOutputStream writeByteArrayLength(byte[] bytes)

#### writeString

    public PacketOutputStream writeString(String str)

#### writeShort

    public PacketOutputStream writeShort(short theShort)

#### writeInt

    public PacketOutputStream writeInt(int theInt)

#### writeLong

    public PacketOutputStream writeLong(long theLong)

#### writeFieldLength

    public PacketOutputStream writeFieldLength(long length)

#### writeStringLength

    public PacketOutputStream writeStringLength(String str)

#### writeTimestampLength

    public PacketOutputStream writeTimestampLength(Calendar calendar,
                                                   Timestamp ts)

#### writeDateLength

    public PacketOutputStream writeDateLength(Calendar calendar)

#### writeTimeLength

    public PacketOutputStream writeTimeLength(Calendar calendar,
                                              boolean fractionalSeconds)