com.github.houbbbbb.sso.nt.factory.EncoderFactory Maven / Gradle / Ivy
The newest version!
package com.github.houbbbbb.sso.nt.factory;
import com.github.houbbbbb.sso.nt.constants.CommonConstants;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.handler.codec.string.StringEncoder;
import java.nio.charset.Charset;
/**
* @todo:
* @author: hbw
* @date: 2020/7/16
**/
public class EncoderFactory extends AbstractFactory {
@Override
public ChannelOutboundHandlerAdapter getEncoder (ItemType type) {
ChannelOutboundHandlerAdapter encoder = null;
switch (type) {
case STRING_ENCODER: encoder = new StringEncoder(Charset.forName(CommonConstants.UTF_8)); break;
default: break;
}
return encoder;
}
}