Package io.netty.handler.codec

Examples of io.netty.handler.codec.EncoderException


            MessageBuf<Object> out = ctx.nextOutboundMessageBuffer();
            ByteBuf payload = Unpooled.buffer(in.readableBytes());
            payload.writeBytes(in);
            out.add(new SctpMessage(streamIdentifier, protocolIdentifier, payload));
        } catch (Throwable t) {
            ctx.fireExceptionCaught(new EncoderException(t));
        }

        ctx.flush(promise);
    }
View Full Code Here


            int compressedLength = deflater.deflate(compressedData);
            deflater.reset();

            if (compressedLength == 0) {
                // compression failed in some weird way
                throw new EncoderException("Failed to compress message of size " + length);
            } else if (compressedLength >= length) {
                // compression increased the size. threshold is probably too low
                // send as an uncompressed packet
                ByteBufUtils.writeVarInt(prefixBuf, 0);
                msg.readerIndex(index);
View Full Code Here

    protected void encode(ChannelHandlerContext ctx, Message msg, List<Object> out) throws Exception {
        // find codec
        final Class<? extends Message> clazz = msg.getClass();
        Codec.CodecRegistration reg = protocol.getCodecRegistration(clazz);
        if (reg == null) {
            throw new EncoderException("Unknown message type: " + clazz + ".");
        }

        // write header
        ByteBuf headerBuf = ctx.alloc().buffer(8);
        ByteBufUtils.writeVarInt(headerBuf, reg.getOpcode());
View Full Code Here

TOP

Related Classes of io.netty.handler.codec.EncoderException

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.