mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-12-20 16:07:36 +01:00
remove unused code
This commit is contained in:
parent
27fbea0cad
commit
37ad066aa3
@ -1,38 +1,6 @@
|
||||
package com.viaversion.fabric.common.handler;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||
import io.netty.handler.codec.MessageToByteEncoder;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
import com.viaversion.viaversion.util.PipelineUtil;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class CommonTransformer {
|
||||
public static final String HANDLER_DECODER_NAME = "via-decoder";
|
||||
public static final String HANDLER_ENCODER_NAME = "via-encoder";
|
||||
|
||||
public static void decompress(ChannelHandlerContext ctx, ByteBuf buf) throws InvocationTargetException {
|
||||
ChannelHandler handler = ctx.pipeline().get("decompress");
|
||||
ByteBuf decompressed = handler instanceof MessageToMessageDecoder
|
||||
? (ByteBuf) PipelineUtil.callDecode((MessageToMessageDecoder<?>) handler, ctx, buf).get(0)
|
||||
: (ByteBuf) PipelineUtil.callDecode((ByteToMessageDecoder) handler, ctx, buf).get(0);
|
||||
try {
|
||||
buf.clear().writeBytes(decompressed);
|
||||
} finally {
|
||||
decompressed.release();
|
||||
}
|
||||
}
|
||||
|
||||
public static void compress(ChannelHandlerContext ctx, ByteBuf buf) throws Exception {
|
||||
ByteBuf compressed = ctx.alloc().buffer();
|
||||
try {
|
||||
PipelineUtil.callEncode((MessageToByteEncoder<?>) ctx.pipeline().get("compress"), ctx, buf, compressed);
|
||||
buf.clear().writeBytes(compressed);
|
||||
} finally {
|
||||
compressed.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user