Class CompressionSplittedOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.mysql.cj.protocol.x.CompressionSplittedOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

public class CompressionSplittedOutputStream
extends java.io.FilterOutputStream
An OutputStream wrapper that analyzes X Protocol frames and routes them directly to the original underlying OutputStream or passes them through to a compressor-able OutputStream to compresses the frame, rebuilds it and then sends a newly compressed X Protocol frame, depending on defined data size threshold.
  • Field Summary

    Fields inherited from class java.io.FilterOutputStream

    out
  • Constructor Summary

    Constructors 
    Constructor Description
    CompressionSplittedOutputStream​(java.io.OutputStream out, CompressorStreamsFactory ioStreamsFactory)  
  • Method Summary

    Modifier and Type Method Description
    void close()
    Closes this stream.
    void write​(byte[] b)
    Forwards the write to write(byte[], int, int);
    void write​(byte[] b, int off, int len)
    Analyzes the given bytes as an X Protocol frame and, depending on its size, writes it as-is in the underlying OutputStream or rebuilds it as a compressed X Protocol packet.
    void write​(int b)
    Forwards the write to write(byte[], int, int);

    Methods inherited from class java.io.FilterOutputStream

    flush

    Methods inherited from class java.io.OutputStream

    nullOutputStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • close

      public void close() throws java.io.IOException
      Closes this stream.
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Overrides:
      close in class java.io.FilterOutputStream
      Throws:
      java.io.IOException
      See Also:
      FilterOutputStream.close()
    • write

      public void write​(int b) throws java.io.IOException
      Forwards the write to write(byte[], int, int);
      Overrides:
      write in class java.io.FilterOutputStream
      Throws:
      java.io.IOException
      See Also:
      FilterOutputStream.write(int)
    • write

      public void write​(byte[] b) throws java.io.IOException
      Forwards the write to write(byte[], int, int);
      Overrides:
      write in class java.io.FilterOutputStream
      Throws:
      java.io.IOException
      See Also:
      FilterOutputStream.write(byte[])
    • write

      public void write​(byte[] b, int off, int len) throws java.io.IOException
      Analyzes the given bytes as an X Protocol frame and, depending on its size, writes it as-is in the underlying OutputStream or rebuilds it as a compressed X Protocol packet.
      Overrides:
      write in class java.io.FilterOutputStream
      Throws:
      java.io.IOException
      See Also:
      FilterOutputStream.write(int)