Exemplo n.º 1
0
        public NetMessage Unmarshall(byte[] data)
        {
            try{
                Stream    stream    = new MemoryStream(data);
                TProtocol tProtocol = new TBinaryProtocol(new TStreamTransport(stream, stream));

                Atom message = new Atom();
                message.Read(tProtocol);

                NetMessage netMsg = ThriftMessageConverter.translate(message);
                return(netMsg);
            }catch (Exception ex) {
                log.Error("Error unmarshalling message", ex);
            }
            return(null);
        }
Exemplo n.º 2
0
        public byte[] Marshall(NetMessage message)
        {
            try{
                Atom thriftMessage = ThriftMessageConverter.translate(message);

                MemoryStream stream    = new MemoryStream();
                TProtocol    tProtocol = new TBinaryProtocol(new TStreamTransport(stream, stream));

                thriftMessage.Write(tProtocol);

                byte[] data = stream.ToArray();

                return(data);
            }catch (Exception ex) {
                log.Error("Error marshalling message", ex);
            }

            return(null);
        }