当前位置: 首页>>代码示例>>Java>>正文


Java ProtoWriter类代码示例

本文整理汇总了Java中com.squareup.wire.ProtoWriter的典型用法代码示例。如果您正苦于以下问题:Java ProtoWriter类的具体用法?Java ProtoWriter怎么用?Java ProtoWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProtoWriter类属于com.squareup.wire包,在下文中一共展示了ProtoWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, BgReadingMessage value) throws IOException {
  if (value.timestamp != null) ProtoAdapter.SINT64.encodeWithTag(writer, 1, value.timestamp);
  if (value.time_since_sensor_started != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 2, value.time_since_sensor_started);
  if (value.raw_data != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 3, value.raw_data);
  if (value.filtered_data != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 4, value.filtered_data);
  if (value.age_adjusted_raw_value != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 5, value.age_adjusted_raw_value);
  if (value.calibration_flag != null) ProtoAdapter.BOOL.encodeWithTag(writer, 6, value.calibration_flag);
  if (value.calculated_value != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 7, value.calculated_value);
  if (value.filtered_calculated_value != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 8, value.filtered_calculated_value);
  if (value.calculated_value_slope != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 9, value.calculated_value_slope);
  if (value.a != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 30, value.a);
  if (value.b != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 31, value.b);
  if (value.c != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 32, value.c);
  if (value.ra != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 33, value.ra);
  if (value.rb != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 34, value.rb);
  if (value.rc != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 35, value.rc);
  if (value.uuid != null) ProtoAdapter.STRING.encodeWithTag(writer, 10, value.uuid);
  if (value.calibration_uuid != null) ProtoAdapter.STRING.encodeWithTag(writer, 11, value.calibration_uuid);
  if (value.sensor_uuid != null) ProtoAdapter.STRING.encodeWithTag(writer, 12, value.sensor_uuid);
  if (value.ignoreforstats != null) ProtoAdapter.BOOL.encodeWithTag(writer, 13, value.ignoreforstats);
  if (value.raw_calculated != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 14, value.raw_calculated);
  if (value.hide_slope != null) ProtoAdapter.BOOL.encodeWithTag(writer, 15, value.hide_slope);
  if (value.noise != null) ProtoAdapter.STRING.encodeWithTag(writer, 16, value.noise);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:27,代码来源:BgReadingMessage.java

示例2: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, SimpleMessage value) throws IOException {
  ProtoAdapter.INT32.encodeWithTag(writer, 1, value.optional_int32);
  NestedMessage.ADAPTER.encodeWithTag(writer, 2, value.optional_nested_msg);
  ExternalMessage.ADAPTER.encodeWithTag(writer, 3, value.optional_external_msg);
  NestedEnum.ADAPTER.encodeWithTag(writer, 4, value.default_nested_enum);
  ProtoAdapter.INT32.encodeWithTag(writer, 5, value.required_int32);
  ProtoAdapter.DOUBLE.asRepeated().encodeWithTag(writer, 6, value.repeated_double);
  ForeignEnum.ADAPTER.encodeWithTag(writer, 7, value.default_foreign_enum);
  ForeignEnum.ADAPTER.encodeWithTag(writer, 8, value.no_default_foreign_enum);
  ProtoAdapter.STRING.encodeWithTag(writer, 9, value.package_);
  ProtoAdapter.STRING.encodeWithTag(writer, 10, value.result);
  ProtoAdapter.STRING.encodeWithTag(writer, 11, value.other);
  ProtoAdapter.STRING.encodeWithTag(writer, 12, value.o);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:square,项目名称:wire,代码行数:17,代码来源:SimpleMessage.java

示例3: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, MessageOptions value) throws IOException {
  ProtoAdapter.BOOL.encodeWithTag(writer, 1, value.message_set_wire_format);
  ProtoAdapter.BOOL.encodeWithTag(writer, 2, value.no_standard_descriptor_accessor);
  ProtoAdapter.BOOL.encodeWithTag(writer, 3, value.deprecated);
  ProtoAdapter.BOOL.encodeWithTag(writer, 7, value.map_entry);
  UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
  FooBar.ADAPTER.encodeWithTag(writer, 50001, value.my_message_option_one);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 50002, value.my_message_option_two);
  FooBar.ADAPTER.encodeWithTag(writer, 50003, value.my_message_option_three);
  FooBar.FooBarBazEnum.ADAPTER.encodeWithTag(writer, 50004, value.my_message_option_four);
  FooBar.ADAPTER.encodeWithTag(writer, 50005, value.my_message_option_five);
  FooBar.ADAPTER.encodeWithTag(writer, 50006, value.my_message_option_six);
  ForeignMessage.ADAPTER.encodeWithTag(writer, 50007, value.foreign_message_option);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:square,项目名称:wire,代码行数:17,代码来源:MessageOptions.java

示例4: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, FileOptions value) throws IOException {
  ProtoAdapter.STRING.encodeWithTag(writer, 1, value.java_package);
  ProtoAdapter.STRING.encodeWithTag(writer, 8, value.java_outer_classname);
  ProtoAdapter.BOOL.encodeWithTag(writer, 10, value.java_multiple_files);
  ProtoAdapter.BOOL.encodeWithTag(writer, 20, value.java_generate_equals_and_hash);
  ProtoAdapter.BOOL.encodeWithTag(writer, 27, value.java_string_check_utf8);
  OptimizeMode.ADAPTER.encodeWithTag(writer, 9, value.optimize_for);
  ProtoAdapter.STRING.encodeWithTag(writer, 11, value.go_package);
  ProtoAdapter.BOOL.encodeWithTag(writer, 16, value.cc_generic_services);
  ProtoAdapter.BOOL.encodeWithTag(writer, 17, value.java_generic_services);
  ProtoAdapter.BOOL.encodeWithTag(writer, 18, value.py_generic_services);
  ProtoAdapter.BOOL.encodeWithTag(writer, 23, value.deprecated);
  ProtoAdapter.BOOL.encodeWithTag(writer, 31, value.cc_enable_arenas);
  ProtoAdapter.STRING.encodeWithTag(writer, 36, value.objc_class_prefix);
  ProtoAdapter.STRING.encodeWithTag(writer, 37, value.csharp_namespace);
  UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:square,项目名称:wire,代码行数:20,代码来源:FileOptions.java

示例5: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, FieldOptions value) throws IOException {
  CType.ADAPTER.encodeWithTag(writer, 1, value.ctype);
  ProtoAdapter.BOOL.encodeWithTag(writer, 2, value.packed);
  JSType.ADAPTER.encodeWithTag(writer, 6, value.jstype);
  ProtoAdapter.BOOL.encodeWithTag(writer, 5, value.lazy);
  ProtoAdapter.BOOL.encodeWithTag(writer, 3, value.deprecated);
  ProtoAdapter.BOOL.encodeWithTag(writer, 10, value.weak);
  UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
  ProtoAdapter.INT32.encodeWithTag(writer, 60001, value.my_field_option_one);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 60002, value.my_field_option_two);
  FooBar.FooBarBazEnum.ADAPTER.encodeWithTag(writer, 60003, value.my_field_option_three);
  FooBar.ADAPTER.encodeWithTag(writer, 60004, value.my_field_option_four);
  ProtoAdapter.STRING.encodeWithTag(writer, 22101, value.squareup_protos_extension_collision_1_a);
  ProtoAdapter.STRING.encodeWithTag(writer, 22102, value.b);
  ProtoAdapter.STRING.encodeWithTag(writer, 22103, value.squareup_protos_extension_collision_2_a);
  ProtoAdapter.STRING.encodeWithTag(writer, 22104, value.c);
  ProtoAdapter.BOOL.encodeWithTag(writer, 22200, value.redacted);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:square,项目名称:wire,代码行数:21,代码来源:FieldOptions.java

示例6: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, FileDescriptorProto value) throws IOException {
  ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name);
  ProtoAdapter.STRING.encodeWithTag(writer, 2, value.package_);
  ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 3, value.dependency);
  ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 10, value.public_dependency);
  ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 11, value.weak_dependency);
  DescriptorProto.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.message_type);
  EnumDescriptorProto.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.enum_type);
  ServiceDescriptorProto.ADAPTER.asRepeated().encodeWithTag(writer, 6, value.service);
  FieldDescriptorProto.ADAPTER.asRepeated().encodeWithTag(writer, 7, value.extension);
  FileOptions.ADAPTER.encodeWithTag(writer, 8, value.options);
  SourceCodeInfo.ADAPTER.encodeWithTag(writer, 9, value.source_code_info);
  ProtoAdapter.STRING.encodeWithTag(writer, 12, value.syntax);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:square,项目名称:wire,代码行数:17,代码来源:FileDescriptorProto.java

示例7: messageAdapterEncode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
private MethodSpec messageAdapterEncode(NameAllocator nameAllocator, MessageType type,
    TypeName javaType, boolean useBuilder) {
  MethodSpec.Builder result = MethodSpec.methodBuilder("encode")
      .addAnnotation(Override.class)
      .addModifiers(PUBLIC)
      .addParameter(ProtoWriter.class, "writer")
      .addParameter(javaType, "value")
      .addException(IOException.class);

  for (Field field : type.fieldsAndOneOfFields()) {
    int fieldTag = field.tag();
    CodeBlock adapter = adapterFor(field);
    result.addCode("$L.encodeWithTag(writer, $L, ", adapter, fieldTag)
        .addCode((useBuilder ? "value.$L" : "$L(value)"), nameAllocator.get(field))
        .addCode(");\n");
  }

  if (useBuilder) {
    result.addStatement("writer.writeBytes(value.unknownFields())");
  }

  return result.build();
}
 
开发者ID:square,项目名称:wire,代码行数:24,代码来源:JavaGenerator.java

示例8: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, FrameEntity value) throws IOException {
  ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.alpha);
  Layout.ADAPTER.encodeWithTag(writer, 2, value.layout);
  Transform.ADAPTER.encodeWithTag(writer, 3, value.transform);
  ProtoAdapter.STRING.encodeWithTag(writer, 4, value.clipPath);
  ShapeEntity.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.shapes);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:yyued,项目名称:SVGAPlayer-Android,代码行数:10,代码来源:FrameEntity.java

示例9: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, MovieParams value) throws IOException {
  ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.viewBoxWidth);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.viewBoxHeight);
  ProtoAdapter.INT32.encodeWithTag(writer, 3, value.fps);
  ProtoAdapter.INT32.encodeWithTag(writer, 4, value.frames);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:yyued,项目名称:SVGAPlayer-Android,代码行数:9,代码来源:MovieParams.java

示例10: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, Layout value) throws IOException {
  ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.width);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.height);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:yyued,项目名称:SVGAPlayer-Android,代码行数:9,代码来源:Layout.java

示例11: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, RectArgs value) throws IOException {
  ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.width);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.height);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 5, value.cornerRadius);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:yyued,项目名称:SVGAPlayer-Android,代码行数:10,代码来源:ShapeEntity.java

示例12: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, Transform value) throws IOException {
  ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.a);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.b);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.c);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.d);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 5, value.tx);
  ProtoAdapter.FLOAT.encodeWithTag(writer, 6, value.ty);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:yyued,项目名称:SVGAPlayer-Android,代码行数:11,代码来源:Transform.java

示例13: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, MovieEntity value) throws IOException {
  ProtoAdapter.STRING.encodeWithTag(writer, 1, value.version);
  MovieParams.ADAPTER.encodeWithTag(writer, 2, value.params);
  images.encodeWithTag(writer, 3, value.images);
  SpriteEntity.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.sprites);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:yyued,项目名称:SVGAPlayer-Android,代码行数:9,代码来源:MovieEntity.java

示例14: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, BloodTestMessage value) throws IOException {
  if (value.timestamp != null) ProtoAdapter.SINT64.encodeWithTag(writer, 1, value.timestamp);
  if (value.mgdl != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 2, value.mgdl);
  if (value.created_timestamp != null) ProtoAdapter.SINT64.encodeWithTag(writer, 3, value.created_timestamp);
  if (value.state != null) ProtoAdapter.SINT64.encodeWithTag(writer, 4, value.state);
  if (value.source != null) ProtoAdapter.STRING.encodeWithTag(writer, 5, value.source);
  if (value.uuid != null) ProtoAdapter.STRING.encodeWithTag(writer, 6, value.uuid);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:11,代码来源:BloodTestMessage.java

示例15: encode

import com.squareup.wire.ProtoWriter; //导入依赖的package包/类
@Override
public void encode(ProtoWriter writer, Talk value) throws IOException {
  ProtoAdapter.FIXED32.encodeWithTag(writer, 1, value.id);
  ProtoAdapter.FIXED64.encodeWithTag(writer, 2, value.date);
  Room.ADAPTER.encodeWithTag(writer, 3, value.room);
  ProtoAdapter.STRING.encodeWithTag(writer, 4, value.title);
  ProtoAdapter.STRING.encodeWithTag(writer, 5, value.speaker);
  writer.writeBytes(value.unknownFields());
}
 
开发者ID:swankjesse,项目名称:encoding,代码行数:10,代码来源:Talk.java


注:本文中的com.squareup.wire.ProtoWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。