/** Encode and write a tag. */ public void writeTag(int fieldNumber, int wireType) throws IOException { writeRawVarint32(WireFormat.makeTag(fieldNumber, wireType)); }
/** * Reads and discards a single field, given its tag value. * * @return {@code false} if the tag is an endgroup tag, in which case * nothing is skipped. Otherwise, returns {@code true}. */ public boolean skipField(int tag) throws IOException { switch (WireFormat.getTagWireType(tag)) { case WireFormat.WIRETYPE_VARINT: readInt32(); return true; case WireFormat.WIRETYPE_FIXED64: readRawLittleEndian64(); return true; case WireFormat.WIRETYPE_LENGTH_DELIMITED: skipRawBytes(readRawVarint32()); return true; case WireFormat.WIRETYPE_START_GROUP: skipMessage(); checkLastTagWas(WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: return false; case WireFormat.WIRETYPE_FIXED32: readRawLittleEndian32(); return true; default: throw InvalidProtocolBufferException.invalidWireType(); } }
/** * Reads and discards a single field, given its tag value. * * @return {@code false} if the tag is an endgroup tag, in which case * nothing is skipped. Otherwise, returns {@code true}. */ public boolean skipField(int tag) throws IOException { switch (WireFormat.getTagWireType(tag)) { case WireFormat.WIRETYPE_VARINT: readInt32(); return true; case WireFormat.WIRETYPE_FIXED64: readRawLittleEndian64(); return true; case WireFormat.WIRETYPE_LENGTH_DELIMITED: skipRawBytes(readRawVarint32()); return true; case WireFormat.WIRETYPE_START_GROUP: skipMessage(); checkLastTagWas(WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: return false; case WireFormat.WIRETYPE_FIXED32: readRawLittleEndian32(); return true; default: throw InvalidProtocolBufferException.invalidWireType(); } }
/** * Reads and discards a single field, given its tag value. * * @return {@code false} if the tag is an endgroup tag, in which case * nothing is skipped. Otherwise, returns {@code true}. */ public boolean skipField(int tag) throws IOException { switch (WireFormat.getTagWireType(tag)) { case WireFormat.WIRETYPE_VARINT: readInt32(); return true; case WireFormat.WIRETYPE_FIXED64: readRawLittleEndian64(); return true; case WireFormat.WIRETYPE_LENGTH_DELIMITED: skipRawBytes(readRawVarint32()); return true; case WireFormat.WIRETYPE_START_GROUP: skipMessage(); checkLastTagWas(WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: return false; case WireFormat.WIRETYPE_FIXED32: readRawLittleEndian32(); return true; default: throw InvalidProtocolBufferException.invalidWireType(); } }
/** Encode and write a tag. */ public void writeTag(int fieldNumber, int wireType) throws IOException { writeRawVarint32(WireFormat.makeTag(fieldNumber, wireType)); }
/** Compute the number of bytes that would be needed to encode a tag. */ public static int computeTagSize(int fieldNumber) { return computeRawVarint32Size(WireFormat.makeTag(fieldNumber, 0)); }
/** Encode and write a tag. */ public void writeTag(int fieldNumber, int wireType) throws IOException { writeRawVarint32(WireFormat.makeTag(fieldNumber, wireType)); }
/** Compute the number of bytes that would be needed to encode a tag. */ public static int computeTagSize(int fieldNumber) { return computeRawVarint32Size(WireFormat.makeTag(fieldNumber, 0)); }
/** Compute the number of bytes that would be needed to encode a tag. */ public static int computeTagSize(int fieldNumber) { return computeRawVarint32Size(WireFormat.makeTag(fieldNumber, 0)); }
static protected <T extends BaseMessage> T readGroup(CodedInputStream input, int tag, T group) throws IOException { group.mergeUnframed(input); input.checkLastTagWas(makeTag(tag, WIRETYPE_END_GROUP)); return group; }
static protected <T extends BaseMessage> T readGroup(CodedInputStream input, int tag, T group) throws IOException { group.mergeUnframed(input); input.checkLastTagWas(makeTag(tag, WIRETYPE_END_GROUP)); return group; }
static protected <T extends BaseMessage> T readGroup(CodedInputStream input, int tag, T group) throws IOException { group.mergeUnframed(input); input.checkLastTagWas(makeTag(tag, WIRETYPE_END_GROUP)); return group; }
+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); p(setter + "(input.readString());"); } else if (field.getType() == FieldDescriptor.BYTES_TYPE) { p("case "+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); String override = getOption(field.getOptions(), "java_override_type", null); p("case " + makeTag(field.getTag(), WIRETYPE_VARINT)+ ":"); indent(); p(setter + "(input.readBool());"); } else if (field.getType() == FieldDescriptor.DOUBLE_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED64) + ":"); indent(); p(setter + "(input.readDouble());"); } else if (field.getType() == FieldDescriptor.FLOAT_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED32) + ":"); indent(); p(setter + "(input.readFloat());"); } else if (field.getType() == FieldDescriptor.INT32_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent(); p(setter + "(input.readInt32());"); } else if (field.getType() == FieldDescriptor.INT64_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT)
+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); p(setter + "(input.readString());"); } else if (field.getType() == FieldDescriptor.BYTES_TYPE) { p("case "+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); String override = getOption(field.getOptions(), "java_override_type", null); p("case " + makeTag(field.getTag(), WIRETYPE_VARINT)+ ":"); indent(); p(setter + "(input.readBool());"); } else if (field.getType() == FieldDescriptor.DOUBLE_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED64) + ":"); indent(); p(setter + "(input.readDouble());"); } else if (field.getType() == FieldDescriptor.FLOAT_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED32) + ":"); indent(); p(setter + "(input.readFloat());"); } else if (field.getType() == FieldDescriptor.INT32_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent(); p(setter + "(input.readInt32());"); } else if (field.getType() == FieldDescriptor.INT64_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT)
+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); p(setter + "(input.readString());"); } else if (field.getType() == FieldDescriptor.BYTES_TYPE) { p("case "+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); String override = getOption(field.getOptions(), "java_override_type", null); p("case " + makeTag(field.getTag(), WIRETYPE_VARINT)+ ":"); indent(); p(setter + "(input.readBool());"); } else if (field.getType() == FieldDescriptor.DOUBLE_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED64) + ":"); indent(); p(setter + "(input.readDouble());"); } else if (field.getType() == FieldDescriptor.FLOAT_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED32) + ":"); indent(); p(setter + "(input.readFloat());"); } else if (field.getType() == FieldDescriptor.INT32_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent(); p(setter + "(input.readInt32());"); } else if (field.getType() == FieldDescriptor.INT64_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT)
+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); } else if (field.getType() == FieldDescriptor.BYTES_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); p(setter + "(input.readBytes());"); } else if (field.getType() == FieldDescriptor.BOOL_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent(); p(setter + "(input.readBool());"); } else if (field.getType() == FieldDescriptor.DOUBLE_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED64) + ":"); indent(); p(setter + "(input.readDouble());"); } else if (field.getType() == FieldDescriptor.FLOAT_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED32) + ":"); indent(); p(setter + "(input.readFloat());"); } else if (field.getType() == FieldDescriptor.INT32_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent();
+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); } else if (field.getType() == FieldDescriptor.BYTES_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); p(setter + "(input.readBytes());"); } else if (field.getType() == FieldDescriptor.BOOL_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent(); p(setter + "(input.readBool());"); } else if (field.getType() == FieldDescriptor.DOUBLE_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED64) + ":"); indent(); p(setter + "(input.readDouble());"); } else if (field.getType() == FieldDescriptor.FLOAT_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED32) + ":"); indent(); p(setter + "(input.readFloat());"); } else if (field.getType() == FieldDescriptor.INT32_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent();
+ makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); } else if (field.getType() == FieldDescriptor.BYTES_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_LENGTH_DELIMITED) + ":"); indent(); p(setter + "(input.readBytes());"); } else if (field.getType() == FieldDescriptor.BOOL_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent(); p(setter + "(input.readBool());"); } else if (field.getType() == FieldDescriptor.DOUBLE_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED64) + ":"); indent(); p(setter + "(input.readDouble());"); } else if (field.getType() == FieldDescriptor.FLOAT_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_FIXED32) + ":"); indent(); p(setter + "(input.readFloat());"); } else if (field.getType() == FieldDescriptor.INT32_TYPE) { p("case " + makeTag(field.getTag(), WIRETYPE_VARINT) + ":"); indent();