Package com.mysql.cj.protocol.x
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
-
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 towrite(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 underlyingOutputStream
or rebuilds it as a compressed X Protocol packet.void
write(int b)
Forwards the write towrite(byte[], int, int)
;
-
Constructor Details
-
CompressionSplittedOutputStream
public CompressionSplittedOutputStream(java.io.OutputStream out, CompressorStreamsFactory ioStreamsFactory)
-
-
Method Details
-
close
public void close() throws java.io.IOExceptionCloses this stream.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
- See Also:
FilterOutputStream.close()
-
write
public void write(int b) throws java.io.IOExceptionForwards the write towrite(byte[], int, int)
;- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
- See Also:
FilterOutputStream.write(int)
-
write
public void write(byte[] b) throws java.io.IOExceptionForwards the write towrite(byte[], int, int)
;- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
- See Also:
FilterOutputStream.write(byte[])
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionAnalyzes the given bytes as an X Protocol frame and, depending on its size, writes it as-is in the underlyingOutputStream
or rebuilds it as a compressed X Protocol packet.- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
- See Also:
FilterOutputStream.write(int)
-