Tabnine Logo
TextLineCodecFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
TextLineCodecFactory
in
org.apache.mina.filter.codec.textline

Best Java code snippets using org.apache.mina.filter.codec.textline.TextLineCodecFactory (Showing top 5 results out of 315)

origin: mswiderski/jbpm-examples

acceptor.getFilterChain().addLast( "codec", new ProtocolCodecFilter( new TextLineCodecFactory( Charset.forName( "UTF-8" ))));
origin: org.openmobster.core/dataService

TextLineCodecFactory textLine = new TextLineCodecFactory(Charset.forName("UTF-8"),
    LineDelimiter.UNIX.getValue(),
    "EOF");
textLine.setDecoderMaxLineLength(Integer.MAX_VALUE);
textLine.setEncoderMaxLineLength(Integer.MAX_VALUE);
ProtocolCodecFilter codecFilter = new ProtocolCodecFilter(textLine);
this.acceptor.getFilterChain().addLast( "codec", codecFilter);
origin: miltonio/milton2

  public void start() {
    IoBuffer.setUseDirectBuffer(false);
    IoBuffer.setAllocator(new SimpleBufferAllocator());

    acceptor = new NioSocketAcceptor();

//        cfg.getFilterChain().addLast("mimemessage1", new MimeMessageIOFilter() );
    acceptor.getFilterChain().addLast("logger", new LoggingFilter());
    acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("US-ASCII"))));
    acceptor.getFilterChain().addLast("stream", new StreamWriteFilter() );
    acceptor.setHandler( new PopIOHandlerAdapter(resourceFactory, filters) );
    try {
      //cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"))));
      acceptor.bind(new InetSocketAddress(popPort));
    } catch (IOException ex) {
      throw new RuntimeException("Couldnt bind to port: " + popPort, ex);
    }

  }
 
origin: OpenNMS/opennms

/**
 * <p>startServer</p>
 *
 * @throws java.lang.Exception if any.
 */
public void startServer() throws Exception {
  
  m_acceptor = new NioSocketAcceptor();
  m_acceptor.getFilterChain().addLast("logger", new LoggingFilter());
  m_acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(StandardCharsets.UTF_8)));
  
  m_acceptor.setHandler(getServerHandler());
  m_acceptor.getSessionConfig().setReadBufferSize(getBufferSize());
  m_acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, getIdleTime());
  ((NioSocketAcceptor) m_acceptor).setReuseAddress(true);
  m_acceptor.bind(new InetSocketAddress(getPort()));
  
}

origin: r17171709/android_demo

private PushManager() {
  connector=new NioSocketConnector();
  connector.setConnectTimeoutMillis(Params.CONNECT_TIMEOUT);
  //为接收器设置管理服务
  connector.setHandler(new ClientSessionHandler());
  //设置过滤器(使用Mina提供的文本换行符编解码器)
  connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"), LineDelimiter.WINDOWS.getValue(),LineDelimiter.WINDOWS.getValue())));
  //读写通道5秒内无操作进入空闲状态
  connector.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, Params.REQUEST_TIMEOUT);
  //设置读取数据的缓冲区大小
  connector.getSessionConfig().setReadBufferSize(2048);
  //设置心跳
  KeepAliveMessageFactory heartBeatFactory = new ClientKeepAliveMessageFactoryImp();
  KeepAliveRequestTimeoutHandler heartBeatHandler = new ClientKeepAliveMessageTimeoutFactoryImp();
  KeepAliveFilter heartBeat = new KeepAliveFilter(heartBeatFactory, IdleStatus.BOTH_IDLE, heartBeatHandler);
  //是否回发
  heartBeat.setForwardEvent(true);
  //心跳发送频率
  heartBeat.setRequestInterval(Params.REQUEST_INTERVAL);
  connector.getSessionConfig().setKeepAlive(true);
  connector.getFilterChain().addLast("keepalive", heartBeat);
}
org.apache.mina.filter.codec.textlineTextLineCodecFactory

Javadoc

A ProtocolCodecFactory that performs encoding and decoding between a text line data and a Java string object. This codec is useful especially when you work with a text-based protocols such as SMTP and IMAP.

Most used methods

  • <init>
    Creates a new instance of TextLineCodecFactory. This constructor provides more flexibility for the d
  • setDecoderMaxLineLength
    Sets the allowed maximum size of the line to be decoded. If the size of the line to be decoded excee
  • setEncoderMaxLineLength
    Sets the allowed maximum size of the encoded line. If the size of the encoded line exceeds this valu

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now