Package com.google.protobuf

Examples of com.google.protobuf.MessageLite


        ctx.writeAndFlush(outMessage);
        break;

      case RESPONSE:
        try{
        MessageLite m = getResponseDefaultInstance(msg.rpcType);
        assert rpcConfig.checkReceive(msg.rpcType, m.getClass());
        RpcOutcome<?> rpcFuture = queue.getFuture(msg.rpcType, msg.coordinationId, m.getClass());
        Parser<?> parser = m.getParserForType();
        Object value = parser.parseFrom(new ByteBufInputStream(msg.pBody, msg.pBody.readableBytes()));
        rpcFuture.set(value, msg.dBody);
        msg.release()// we release our ownership.  Handle could have taken over ownership.
        if (RpcConstants.EXTRA_DEBUGGING) logger.debug("Updated rpc future {} with value {}", rpcFuture, value);
        }catch(Exception ex){
View Full Code Here


        break;
      }

      case RESPONSE:
        try{
        MessageLite m = getResponseDefaultInstance(msg.rpcType);
        assert rpcConfig.checkReceive(msg.rpcType, m.getClass());
        RpcOutcome<?> rpcFuture = queue.getFuture(msg.rpcType, msg.coordinationId, m.getClass());
        Parser<?> parser = m.getParserForType();
        Object value = parser.parseFrom(new ByteBufInputStream(msg.pBody, msg.pBody.readableBytes()));
        rpcFuture.set(value, msg.dBody);
        msg.release()// we release our ownership.  Handle could have taken over ownership.
        if (RpcConstants.EXTRA_DEBUGGING) logger.debug("Updated rpc future {} with value {}", rpcFuture, value);
        }catch(Exception ex){
View Full Code Here

        break;
      }

      case RESPONSE:
        try{
        MessageLite m = getResponseDefaultInstance(msg.rpcType);
        assert rpcConfig.checkReceive(msg.rpcType, m.getClass());
        RpcOutcome<?> rpcFuture = queue.getFuture(msg.rpcType, msg.coordinationId, m.getClass());
        Parser<?> parser = m.getParserForType();
        Object value = parser.parseFrom(new ByteBufInputStream(msg.pBody, msg.pBody.readableBytes()));
        rpcFuture.set(value, msg.dBody);
        msg.release()// we release our ownership.  Handle could have taken over ownership.
        if (RpcConstants.EXTRA_DEBUGGING) {
          logger.debug("Updated rpc future {} with value {}", rpcFuture, value);
View Full Code Here

   * @param o the object to serialize
   * @return the byte array
   */
  public static final byte[] seriOne(Object o) {
    if (o instanceof MessageLite) {
      MessageLite gen = (MessageLite)o;
      return gen.toByteArray();
    } else {
      throw new SeriException("Message is not protobuf type: " + o.getClass());
    }
  }
View Full Code Here

   * @param o the object to serialize
   * @param output where to write output
   */
  public static final void seriDelimitedOne(Object o, OutputStream output) {
    if (o instanceof MessageLite) {
      MessageLite gen = (MessageLite)o;
      try {
        gen.writeDelimitedTo(output);
      } catch (IOException e) {
        throw new SeriException("Failed to write data to the output stream.", e);
      }
    } else {
      throw new SeriException("Message is not protobuf type: " + o.getClass());
View Full Code Here

           
        }

        public void writeTo(JsonGenerator generator, MessageLite owner, String fieldName) throws IOException
        {
            MessageLite message;
            try
            {
                message = (MessageLite)_messagePropertyAccessor.getValue(owner);
                if(message==null)
                    return;
            }
            catch (IllegalArgumentException e)
            {
                throw new RuntimeException(e);
            }
            catch (IllegalAccessException e)
            {
                throw new RuntimeException(e);
            }
            catch (InvocationTargetException e)
            {
                if(e.getCause() instanceof IOException)
                    throw (IOException)e.getCause();
               
                throw new IOException(e);
            }
           
            ReflectionConvertor convertor = _convertor._lite.get(_messagePropertyAccessor.getTypeClass());
            if(convertor==null)
                throw new IOException("Message not included: " + message.getClass());
           
            generator.writeFieldName(fieldName);
            convertor.generateTo(generator, message);
        }
View Full Code Here

TOP

Related Classes of com.google.protobuf.MessageLite

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.