Package org.apache.mina.filter.codec

Examples of org.apache.mina.filter.codec.ProtocolEncoder


    }

    private static class MyCodec implements ProtocolCodecFactory {

        public ProtocolEncoder getEncoder() throws Exception {
            return new ProtocolEncoder() {
                public void encode(IoSession ioSession, Object message, ProtocolEncoderOutput out)
                    throws Exception {
                    // close session instead of returning a reply
                    ioSession.close();
                }
View Full Code Here


    public MinaUdpProtocolCodecFactory(CamelContext context) {
        this.context = context;
    }

    public ProtocolEncoder getEncoder() throws Exception {
        return new ProtocolEncoder() {

            public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
                ByteBuffer buf = toByteBuffer(message);
                buf.flip();
                out.write(buf);
View Full Code Here

    }

    private static class MyCodec implements ProtocolCodecFactory {

        public ProtocolEncoder getEncoder() throws Exception {
            return new ProtocolEncoder() {
                public void encode(IoSession ioSession, Object message, ProtocolEncoderOutput out)
                    throws Exception {
                    ByteBuffer bb = ByteBuffer.allocate(32).setAutoExpand(true);
                    String s = (String) message;                   
                    bb.put(s.getBytes("US-ASCII"));
View Full Code Here

    }

    private static class MyCodec implements ProtocolCodecFactory {

        public ProtocolEncoder getEncoder() throws Exception {
            return new ProtocolEncoder() {
                public void encode(IoSession ioSession, Object message, ProtocolEncoderOutput out)
                    throws Exception {
                    ByteBuffer bb = ByteBuffer.allocate(32).setAutoExpand(true);
                    String s = (String) message;
                    bb.put(s.getBytes("US-ASCII"));
View Full Code Here

    }

    private class MyCodec implements ProtocolCodecFactory {

        public ProtocolEncoder getEncoder() throws Exception {
            return new ProtocolEncoder() {
                public void encode(IoSession ioSession, Object message, ProtocolEncoderOutput out)
                    throws Exception {
                    // close session instead of returning a reply
                    ioSession.close();
                }
View Full Code Here

        this.context = context;
        this.charset = charset;
    }

    public ProtocolEncoder getEncoder() throws Exception {
        return new ProtocolEncoder() {
            private CharsetEncoder encoder;

            public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
                if (encoder == null) {
                    encoder = charset.newEncoder();
View Full Code Here

    }

    private class MyCodec implements ProtocolCodecFactory {

        public ProtocolEncoder getEncoder() throws Exception {
            return new ProtocolEncoder() {
                public void encode(IoSession ioSession, Object message, ProtocolEncoderOutput out)
                    throws Exception {
                    ByteBuffer bb = ByteBuffer.allocate(32).setAutoExpand(true);
                    String s = (String) message;                   
                    bb.put(s.getBytes("US-ASCII"));
View Full Code Here

    }

    private class MyCodec implements ProtocolCodecFactory {

        public ProtocolEncoder getEncoder() throws Exception {
            return new ProtocolEncoder() {
                public void encode(IoSession ioSession, Object message, ProtocolEncoderOutput out)
                    throws Exception {
                    ByteBuffer bb = ByteBuffer.allocate(32).setAutoExpand(true);
                    String s = (String) message;
                    bb.put(s.getBytes("US-ASCII"));
View Full Code Here

    }

    private static class MyCodec implements ProtocolCodecFactory {

        public ProtocolEncoder getEncoder(IoSession session) throws Exception {
            return new ProtocolEncoder() {

                public void encode(IoSession ioSession, Object message, ProtocolEncoderOutput out)
                    throws Exception {
                    // close session instead of returning a reply
                    ioSession.close(true);
View Full Code Here

  public ProtocolEncoder getEncoder(IoSession ioSession) throws Exception {
    synchronized (encoders) {//TODO: rewrite???
      if (encoders.containsKey(ioSession))
        return encoders.get(ioSession);
     
      ProtocolEncoder encoder = new ResponseEncoder();
      encoders.put(ioSession, encoder);
     
      return encoder;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.mina.filter.codec.ProtocolEncoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.