- java.lang.Object
-
- io.netty5.handler.codec.compression.CompressionHandler
-
- All Implemented Interfaces:
ChannelHandler
public final class CompressionHandler extends Object implements ChannelHandler
-
-
Constructor Summary
Constructors Constructor Description CompressionHandler(Supplier<? extends Compressor> compressorSupplier)
Creates a new instance.CompressionHandler(Supplier<? extends Compressor> compressorSupplier, long closeWriteTimeout, TimeUnit closeWriteTimeoutUnit, boolean discardBytesAfterFinished)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
channelInactive(ChannelHandlerContext ctx)
TheChannel
of theChannelHandlerContext
was registered is now inactive and reached its end of lifetime.Future<Void>
close(ChannelHandlerContext ctx)
Called once a close operation is made.void
handlerAdded(ChannelHandlerContext ctx)
Gets called after theChannelHandler
was added to the actual context and it's ready to handle events.void
handlerRemoved(ChannelHandlerContext ctx)
Gets called after theChannelHandler
was removed from the actual context and it doesn't handle events anymore.Future<Void>
write(ChannelHandlerContext ctx, Object msg)
Called once a write operation is made.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelHandler
bind, channelActive, channelExceptionCaught, channelInboundEvent, channelRead, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, connect, deregister, disconnect, flush, isSharable, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown
-
-
-
-
Constructor Detail
-
CompressionHandler
public CompressionHandler(Supplier<? extends Compressor> compressorSupplier)
Creates a new instance.- Parameters:
compressorSupplier
- theSupplier
that is used to create theCompressor
.
-
CompressionHandler
public CompressionHandler(Supplier<? extends Compressor> compressorSupplier, long closeWriteTimeout, TimeUnit closeWriteTimeoutUnit, boolean discardBytesAfterFinished)
Creates a new instance.- Parameters:
compressorSupplier
- theSupplier
that is used to create theCompressor
.closeWriteTimeout
- the amount to wait before we will close even tho the write of the trailer was not finished yet.closeWriteTimeoutUnit
- the unit of the timeout.discardBytesAfterFinished
-true
if the bytes should be discarded after theCompressor
finished the compression of the whole stream.
-
-
Method Detail
-
handlerAdded
public void handlerAdded(ChannelHandlerContext ctx) throws Exception
Description copied from interface:ChannelHandler
Gets called after theChannelHandler
was added to the actual context and it's ready to handle events.- Specified by:
handlerAdded
in interfaceChannelHandler
- Throws:
Exception
-
handlerRemoved
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
Description copied from interface:ChannelHandler
Gets called after theChannelHandler
was removed from the actual context and it doesn't handle events anymore.- Specified by:
handlerRemoved
in interfaceChannelHandler
- Throws:
Exception
-
channelInactive
public void channelInactive(ChannelHandlerContext ctx) throws Exception
Description copied from interface:ChannelHandler
TheChannel
of theChannelHandlerContext
was registered is now inactive and reached its end of lifetime.- Specified by:
channelInactive
in interfaceChannelHandler
- Throws:
Exception
-
write
public Future<Void> write(ChannelHandlerContext ctx, Object msg)
Description copied from interface:ChannelHandler
Called once a write operation is made. The write operation will write the messages through theChannelPipeline
. Those are then ready to be flushed to the actualChannel
onceChannel.flush()
is called.- Specified by:
write
in interfaceChannelHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the write operation is mademsg
- the message to write- Returns:
- the
Future
which will be notified once the operation completes.
-
close
public Future<Void> close(ChannelHandlerContext ctx)
Description copied from interface:ChannelHandler
Called once a close operation is made.- Specified by:
close
in interfaceChannelHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the close operation is made- Returns:
- the
Future
which will be notified once the operation completes.
-
-