Package com.google.protobuf

Examples of com.google.protobuf.GeneratedMessage$BuilderParent


    List<EnumValueDescriptor> values = enumD.getValues();
    return values.get(random.nextInt(values.size()));
  }

  private GeneratedMessage getRandomMessage(FieldDescriptor field, double p) {
    GeneratedMessage instance = moreInstances.get(field.getMessageType());
    if (instance == null) {
      throw new IllegalArgumentException("Couldn't find instance for message "
          + field.getMessageType().getFullName());
    }
    return new RandomProtobufGenerator<GeneratedMessage>(random, instance, moreInstances)
View Full Code Here


   *
   * @return Response body and request status code
   * @throws IOException if socket read error or protocol parse error
   */
  private ResponseEncapsulation recvMessage() throws IOException {
    GeneratedMessage msg = null;
    byte[] headers = new byte[8];
    recv(headers, headers.length);

    if (headers[0] != 'L' || headers[1] != '1') {
      throw new IOException("Wrong launcher protocol header");
View Full Code Here

                    Class<? extends GeneratedMessage> topClazz = PacketTypes.DEMO.get(kind);
                    if (topClazz == null) {
                        log.warn("unknown top level message of kind {}", kind);
                        continue;
                    }
                    GeneratedMessage message = PacketTypes.parse(topClazz, data);
                    full = false;
                    if (message instanceof CDemoPacket) {
                        es = CodedInputStream.newInstance(((CDemoPacket) message).getData().toByteArray());
                        state = State.EMBED;
                        continue;
                    } else if (message instanceof CDemoSendTables) {
                        es = CodedInputStream.newInstance(((CDemoSendTables) message).getData().toByteArray());
                        state = State.EMBED;
                        continue;
                    } else if (message instanceof CDemoFullPacket) {
                        CDemoFullPacket fullMessage = (CDemoFullPacket)message;
                        es = CodedInputStream.newInstance(fullMessage.getPacket().getData().toByteArray());
                        state = State.EMBED;
                        full = true;
                        if (!isFiltered(CDemoStringTables.class)) {
                            return genPeek(fullMessage.getStringTable());
                        }
                    } else if (!isFiltered(message.getClass())) {
                        return genPeek(message);
                    }
                    continue;

                case EMBED:
                    if (es.isAtEnd()) {
                        es = null;
                        state = State.TOP;
                        continue;
                    }
                    int subKind = es.readRawVarint32();
                    int subSize = es.readRawVarint32();
                    byte[] subData = es.readRawBytes(subSize);
                    Class<? extends GeneratedMessage> subClazz = PacketTypes.EMBED.get(subKind);
                    if (subClazz == null) {
                        log.warn("unknown embedded message of kind {}", subKind);
                        continue;
                    }
                    GeneratedMessage subMessage = PacketTypes.parse(subClazz, subData);
                    if (subMessage instanceof CNETMsg_Tick) {
                        tick = ((CNETMsg_Tick) subMessage).getTick();
                        border = border.addNetTickBorder();
                        if (!isFiltered(CNETMsg_Tick.class)) {
                            return genPeek(subMessage);
                        }
                    } else if (subMessage instanceof CSVCMsg_UserMessage) {
                        if (!isFiltered(CSVCMsg_UserMessage.class)) {
                            CSVCMsg_UserMessage userMessage = (CSVCMsg_UserMessage) subMessage;
                            Class<? extends GeneratedMessage> umClazz = PacketTypes.USERMSG.get(userMessage.getMsgType());
                            if (umClazz == null) {
                                log.warn("unknown usermessage of kind {}", userMessage.getMsgType());
                                continue;
                            } else if (!isFiltered(umClazz)) {
                                return genPeek(PacketTypes.parse(umClazz, userMessage.getMsgData().toByteArray()));
                            }
                        }
                    } else if (!isFiltered(subMessage.getClass())) {
                        return genPeek(subMessage);
                    }
                    continue;
            }
        }
View Full Code Here

        @SuppressWarnings("unchecked")
        Handler<T> h = (Handler<T>) H.get(message.getClass());
        if (h != null) {
            h.apply(peekTick, message, match);
        } else {
            GeneratedMessage gm = (GeneratedMessage)message;
            log.trace("unable to apply message of type {}", gm.getDescriptorForType().getName());
        }
    }
View Full Code Here

TOP

Related Classes of com.google.protobuf.GeneratedMessage$BuilderParent

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.