com.google.protobuf.Any.getTypeUrlBytes()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中com.google.protobuf.Any.getTypeUrlBytes()方法的一些代码示例,展示了Any.getTypeUrlBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Any.getTypeUrlBytes()方法的具体详情如下:
包路径:com.google.protobuf.Any
类名称:Any
方法名:getTypeUrlBytes

Any.getTypeUrlBytes介绍

[英]```
A URL/resource name whose content describes the type of the
serialized protocol buffer message.
For URLs which use the scheme http, https, or no scheme, the
following restrictions and interpretations apply:

  • If no scheme is provided, https is assumed.
  • The last segment of the URL's path must represent the fully
    qualified name of the type (as in path/google.protobuf.Duration).
    The name should be in a canonical form (e.g., leading "." is
    not accepted).
  • An HTTP GET on the URL must yield a [google.protobuf.Type][]
    value in binary format, or produce an error.
  • Applications are allowed to cache lookup results based on the
    URL, or have them precompiled into a binary to avoid any
    lookup. Therefore, binary compatibility needs to be preserved
    on changes to types. (Use versioned type names to manage
    breaking changes.)
    Schemes other than http, https (or the empty scheme) might be
    used with implementation specific semantics.
`optional string type_url = 1;`
[中]```
A URL/resource name whose content describes the type of the 
serialized protocol buffer message. 
For URLs which use the scheme `http`, `https`, or no scheme, the 
following restrictions and interpretations apply: 
* If no scheme is provided, `https` is assumed. 
* The last segment of the URL's path must represent the fully 
qualified name of the type (as in `path/google.protobuf.Duration`). 
The name should be in a canonical form (e.g., leading "." is 
not accepted). 
* An HTTP GET on the URL must yield a [google.protobuf.Type][] 
value in binary format, or produce an error. 
* Applications are allowed to cache lookup results based on the 
URL, or have them precompiled into a binary to avoid any 
lookup. Therefore, binary compatibility needs to be preserved 
on changes to types. (Use versioned type names to manage 
breaking changes.) 
Schemes other than `http`, `https` (or the empty scheme) might be 
used with implementation specific semantics.

optional string type_url = 1;

代码示例

代码示例来源:origin: com.google.protobuf/protobuf-java

@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
          throws java.io.IOException {
 if (!getTypeUrlBytes().isEmpty()) {
  com.google.protobuf.GeneratedMessageV3.writeString(output, 1, typeUrl_);
 }
 if (!value_.isEmpty()) {
  output.writeBytes(2, value_);
 }
 unknownFields.writeTo(output);
}

代码示例来源:origin: com.google.protobuf/protobuf-java

@java.lang.Override
public int getSerializedSize() {
 int size = memoizedSize;
 if (size != -1) return size;
 size = 0;
 if (!getTypeUrlBytes().isEmpty()) {
  size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, typeUrl_);
 }
 if (!value_.isEmpty()) {
  size += com.google.protobuf.CodedOutputStream
   .computeBytesSize(2, value_);
 }
 size += unknownFields.getSerializedSize();
 memoizedSize = size;
 return size;
}

代码示例来源:origin: yeriomin/play-store-api

/**
 * <pre>
 * A URL/resource name whose content describes the type of the
 * serialized protocol buffer message.
 * For URLs which use the scheme `http`, `https`, or no scheme, the
 * following restrictions and interpretations apply:
 * * If no scheme is provided, `https` is assumed.
 * * The last segment of the URL's path must represent the fully
 *   qualified name of the type (as in `path/google.protobuf.Duration`).
 *   The name should be in a canonical form (e.g., leading "." is
 *   not accepted).
 * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
 *   value in binary format, or produce an error.
 * * Applications are allowed to cache lookup results based on the
 *   URL, or have them precompiled into a binary to avoid any
 *   lookup. Therefore, binary compatibility needs to be preserved
 *   on changes to types. (Use versioned type names to manage
 *   breaking changes.)
 * Schemes other than `http`, `https` (or the empty scheme) might be
 * used with implementation specific semantics.
 * </pre>
 *
 * <code>optional string type_url = 1;</code>
 */
public com.google.protobuf.ByteString
  getTypeUrlBytes() {
 return instance.getTypeUrlBytes();
}
/**

相关文章