Class Bzip2Encoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelOutboundHandlerAdapter
-
- io.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>
-
- io.netty.handler.codec.compression.Bzip2Encoder
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelOutboundHandler
public class Bzip2Encoder extends io.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>Compresses aByteBufusing the Bzip2 algorithm. See Bzip2.
-
-
Constructor Summary
Constructors Constructor Description Bzip2Encoder()Creates a new bzip2 encoder with the maximum (900,000 byte) block size.Bzip2Encoder(int blockSizeMultiplier)Creates a new bzip2 encoder with the specifiedblockSizeMultiplier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty.channel.ChannelFutureclose()Close thisBzip2Encoderand so finish the encoding.voidclose(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)io.netty.channel.ChannelFutureclose(io.netty.channel.ChannelPromise promise)Close thisBzip2Encoderand so finish the encoding.protected voidencode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, io.netty.buffer.ByteBuf out)voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx)booleanisClosed()Returnstrueif and only if the end of the compressed stream has been reached.-
Methods inherited from class io.netty.handler.codec.MessageToByteEncoder
acceptOutboundMessage, allocateBuffer, isPreferDirect, write
-
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerRemoved, isSharable
-
-
-
-
Constructor Detail
-
Bzip2Encoder
public Bzip2Encoder()
Creates a new bzip2 encoder with the maximum (900,000 byte) block size.
-
Bzip2Encoder
public Bzip2Encoder(int blockSizeMultiplier)
Creates a new bzip2 encoder with the specifiedblockSizeMultiplier.- Parameters:
blockSizeMultiplier- The Bzip2 block size as a multiple of 100,000 bytes (minimum1, maximum9). Larger block sizes require more memory for both compression and decompression, but give better compression ratios.9will usually be the best value to use.
-
-
Method Detail
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, io.netty.buffer.ByteBuf out) throws Exception- Specified by:
encodein classio.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>- Throws:
Exception
-
isClosed
public boolean isClosed()
Returnstrueif and only if the end of the compressed stream has been reached.
-
close
public io.netty.channel.ChannelFuture close()
Close thisBzip2Encoderand so finish the encoding. The returnedChannelFuturewill be notified once the operation completes.
-
close
public io.netty.channel.ChannelFuture close(io.netty.channel.ChannelPromise promise)
Close thisBzip2Encoderand so finish the encoding. The givenChannelFuturewill be notified once the operation completes and will also be returned.
-
close
public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception- Specified by:
closein interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
closein classio.netty.channel.ChannelOutboundHandlerAdapter- Throws:
Exception
-
-