- 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 voidchannelInactive(ChannelHandlerContext ctx)TheChannelof theChannelHandlerContextwas registered is now inactive and reached its end of lifetime.Future<Void>close(ChannelHandlerContext ctx)Called once a close operation is made.voidhandlerAdded(ChannelHandlerContext ctx)Gets called after theChannelHandlerwas added to the actual context and it's ready to handle events.voidhandlerRemoved(ChannelHandlerContext ctx)Gets called after theChannelHandlerwas 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- theSupplierthat is used to create theCompressor.
-
CompressionHandler
public CompressionHandler(Supplier<? extends Compressor> compressorSupplier, long closeWriteTimeout, TimeUnit closeWriteTimeoutUnit, boolean discardBytesAfterFinished)
Creates a new instance.- Parameters:
compressorSupplier- theSupplierthat 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-trueif the bytes should be discarded after theCompressorfinished the compression of the whole stream.
-
-
Method Detail
-
handlerAdded
public void handlerAdded(ChannelHandlerContext ctx) throws Exception
Description copied from interface:ChannelHandlerGets called after theChannelHandlerwas added to the actual context and it's ready to handle events.- Specified by:
handlerAddedin interfaceChannelHandler- Throws:
Exception
-
handlerRemoved
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
Description copied from interface:ChannelHandlerGets called after theChannelHandlerwas removed from the actual context and it doesn't handle events anymore.- Specified by:
handlerRemovedin interfaceChannelHandler- Throws:
Exception
-
channelInactive
public void channelInactive(ChannelHandlerContext ctx) throws Exception
Description copied from interface:ChannelHandlerTheChannelof theChannelHandlerContextwas registered is now inactive and reached its end of lifetime.- Specified by:
channelInactivein interfaceChannelHandler- Throws:
Exception
-
write
public Future<Void> write(ChannelHandlerContext ctx, Object msg)
Description copied from interface:ChannelHandlerCalled once a write operation is made. The write operation will write the messages through theChannelPipeline. Those are then ready to be flushed to the actualChannelonceChannel.flush()is called.- Specified by:
writein interfaceChannelHandler- Parameters:
ctx- theChannelHandlerContextfor which the write operation is mademsg- the message to write- Returns:
- the
Futurewhich will be notified once the operation completes.
-
close
public Future<Void> close(ChannelHandlerContext ctx)
Description copied from interface:ChannelHandlerCalled once a close operation is made.- Specified by:
closein interfaceChannelHandler- Parameters:
ctx- theChannelHandlerContextfor which the close operation is made- Returns:
- the
Futurewhich will be notified once the operation completes.
-
-