Examples of ProtocolEncoderException


Examples of org.apache.mina.codec.ProtocolEncoderException

    @Override
    public void writeTo(INPUT message, ByteBuffer buffer) {
        try {
            buffer.put(prepareBuffer(message));
        } catch (TException e) {
            throw new ProtocolEncoderException(e);
        }
    }
View Full Code Here

Examples of org.apache.mina.codec.ProtocolEncoderException

                byte[] encoded = out.toByteArray();
                encodedMessage = ByteBuffer.wrap(encoded);
                out.close();
            } catch (IOException ioEx) {
                LOG.error("error while marshalling", ioEx);
                throw new ProtocolEncoderException(ioEx.getMessage());
            }
        } else if (message instanceof SpecificRecord) {
            DatumWriter<T> writer = new SpecificDatumWriter<T>(message.getSchema());
            Encoder encoder = EncoderFactory.get().binaryEncoder(out, null);
            try {
                writer.write(message, encoder);
                encoder.flush();
                byte[] encoded = out.toByteArray();
                encodedMessage = ByteBuffer.wrap(encoded);
                out.close();
            } catch (IOException ioEx) {
                LOG.error("error while marshalling", ioEx);
                throw new ProtocolEncoderException(ioEx.getMessage());
            }
        } else {
            LOG.warn("Unknown object type, serialization method not known for {}", message.getClass());
            throw new ProtocolEncoderException(message.getClass() + " cannot be Serialized");
        }

        return encodedMessage != null ? encodedMessage.capacity() : -1;
    }
View Full Code Here

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

        public void encode(IoSession session, Object message,
                ProtocolEncoderOutput out) throws Exception {
            Class<?> type = message.getClass();
            MessageEncoder encoder = findEncoder(type);
            if (encoder == null) {
                throw new ProtocolEncoderException("Unexpected message type: "
                        + type);
            }

            encoder.encode(session, message, out);
        }
View Full Code Here

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

    }

    public void encode(IoSession session, Object message,
            ProtocolEncoderOutput out) throws Exception {
        if (!(message instanceof Message)) {
            throw new ProtocolEncoderException(
                    "This encoder can decode only Netty Messages.");
        }

        for (;;) {
            ByteBuffer buf = ByteBuffer.allocate(8192);
View Full Code Here

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

        public void encode(IoSession session, Object message,
                ProtocolEncoderOutput out) throws Exception {
            Class<?> type = message.getClass();
            MessageEncoder encoder = findEncoder(type);
            if (encoder == null) {
                throw new ProtocolEncoderException("Unexpected message type: "
                        + type);
            }

            encoder.encode(session, message, out);
        }
View Full Code Here

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

    public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception
    {
        if( !( message instanceof Message ) )
        {
            throw new ProtocolEncoderException(
                    "This encoder can decode only Netty Messages." );
        }

        for( ;; )
        {
View Full Code Here

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

        {
            Class type = message.getClass();
            MessageEncoder encoder = findEncoder( type );
            if( encoder == null )
            {
                throw new ProtocolEncoderException( "Unexpected message type: " + type );
            }
           
            encoder.encode( session, message, out );
        }
View Full Code Here

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

        public void encode(IoSession session, Object message,
                ProtocolEncoderOutput out) throws Exception {
            Class type = message.getClass();
            MessageEncoder encoder = findEncoder(type);
            if (encoder == null) {
                throw new ProtocolEncoderException("Unexpected message type: "
                        + type);
            }

            encoder.encode(session, message, out);
        }
View Full Code Here

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

    public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception
    {
        if( !( message instanceof Message ) )
        {
            throw new ProtocolEncoderException(
                    "This encoder can decode only Netty Messages." );
        }

        for( ;; )
        {
View Full Code Here

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

        {
            Class type = message.getClass();
            MessageEncoder encoder = findEncoder( type );
            if( encoder == null )
            {
                throw new ProtocolEncoderException( "Unexpected message type: " + type );
            }
           
            encoder.encode( session, message, out );
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.