remove unused code

This commit is contained in:
creeper123123321 2021-06-17 10:48:33 -03:00 committed by GitHub
parent 27fbea0cad
commit 37ad066aa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();
}
}
}