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 voidclose()Closes this stream.voidwrite(byte[] b)Forwards the write towrite(byte[], int, int);voidwrite(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 underlyingOutputStreamor rebuilds it as a compressed X Protocol packet.voidwrite(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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein 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:
writein 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:
writein 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 underlyingOutputStreamor rebuilds it as a compressed X Protocol packet.- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException- See Also:
FilterOutputStream.write(int)
-