Package com.alibaba.dubbo.remoting.exchange.support

Examples of com.alibaba.dubbo.remoting.exchange.support.MultiMessage


    }

    public Object decode(Channel channel, InputStream input) throws IOException {
        UnsafeByteArrayInputStream bis = (UnsafeByteArrayInputStream)input;
        int save = bis.position();
        MultiMessage result = MultiMessage.create();
        do {
            Object obj = codec.decode(channel, bis);
            if (NEED_MORE_INPUT == obj) {
                bis.position(save);
                break;
            } else {
                result.addMessage(obj);
                logMessageLength(obj, bis.position() - save);
                save = bis.position();
            }
        } while (true);
        if (result.isEmpty()) {
            return NEED_MORE_INPUT;
        }
        if (result.size() == 1) {
            return result.get(0);
        }
        return result;
    }
View Full Code Here


    }

    public Object decode(Channel channel, InputStream input) throws IOException {
        UnsafeByteArrayInputStream bis = (UnsafeByteArrayInputStream)input;
        int save = bis.position();
        MultiMessage result = MultiMessage.create();
        do {
            Object obj = codec.decode(channel, bis);
            if (NEED_MORE_INPUT == obj) {
                bis.position(save);
                break;
            } else {
                result.addMessage(obj);
                logMessageLength(obj, bis.position() - save);
                save = bis.position();
            }
        } while (true);
        if (result.isEmpty()) {
            return NEED_MORE_INPUT;
        }
        if (result.size() == 1) {
            return result.get(0);
        }
        return result;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
  @Override
    public void received(Channel channel, Object message) throws RemotingException {
        if (message instanceof MultiMessage) {
            MultiMessage list = (MultiMessage)message;
            for(Object obj : list) {
                handler.received(channel, obj);
            }
        } else {
            handler.received(channel, message);
View Full Code Here

    @SuppressWarnings("unchecked")
  @Override
    public void received(Channel channel, Object message) throws RemotingException {
        if (message instanceof MultiMessage) {
            MultiMessage list = (MultiMessage)message;
            for(Object obj : list) {
                handler.received(channel, obj);
            }
        } else {
            handler.received(channel, message);
View Full Code Here

    @SuppressWarnings("unchecked")
  @Override
    public void received(Channel channel, Object message) throws RemotingException {
        if (message instanceof MultiMessage) {
            MultiMessage list = (MultiMessage)message;
            for(Object obj : list) {
                handler.received(channel, obj);
            }
        } else {
            handler.received(channel, message);
View Full Code Here

    }

    public Object decode(Channel channel, InputStream input) throws IOException {
        UnsafeByteArrayInputStream bis = (UnsafeByteArrayInputStream)input; // TODO 依赖非接口上的契约!调整实现!
        int beginIdx = bis.position();
        MultiMessage result = MultiMessage.create();
        do {
            Object obj = codec.decode(channel, bis);
            if (NEED_MORE_INPUT == obj) {
                bis.position(beginIdx);
                break;
            } else {
                result.addMessage(obj);
                logMessageLength(obj, bis.position() - beginIdx);
                beginIdx = bis.position();
            }
        } while (true);
        if (result.isEmpty()) {
            return NEED_MORE_INPUT;
        }
        if (result.size() == 1) {
            return result.get(0);
        }
        return result;
    }
View Full Code Here

        codec.encode(channel, buffer, msg);
    }

    public Object decode(Channel channel, ChannelBuffer buffer) throws IOException {
        int save = buffer.readerIndex();
        MultiMessage result = MultiMessage.create();
        do {
            Object obj = codec.decode(channel, buffer);
            if (Codec2.DecodeResult.NEED_MORE_INPUT == obj) {
                buffer.readerIndex(save);
                break;
            } else {
                result.addMessage(obj);
                logMessageLength(obj, buffer.readerIndex() - save);
                save = buffer.readerIndex();
            }
        } while (true);
        if (result.isEmpty()) {
            return Codec2.DecodeResult.NEED_MORE_INPUT;
        }
        if (result.size() == 1) {
            return result.get(0);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of com.alibaba.dubbo.remoting.exchange.support.MultiMessage

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.