本文整理匯總了Java中com.google.protobuf.CodedOutputStream.writeMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java CodedOutputStream.writeMessage方法的具體用法?Java CodedOutputStream.writeMessage怎麽用?Java CodedOutputStream.writeMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.protobuf.CodedOutputStream
的用法示例。
在下文中一共展示了CodedOutputStream.writeMessage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: writeTo
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
public void writeTo(CodedOutputStream output) throws IOException {
this.getSerializedSize();
if((this.bitField0_ & 1) == 1) {
output.writeBytes(1, this.getBodyBytes());
}
for(int i = 0; i < this.attachments_.size(); ++i) {
output.writeMessage(2, (MessageLite)this.attachments_.get(i));
}
if((this.bitField0_ & 2) == 2) {
output.writeMessage(3, this.group_);
}
if((this.bitField0_ & 4) == 4) {
output.writeUInt32(4, this.flags_);
}
if((this.bitField0_ & 8) == 8) {
output.writeMessage(5, this.sync_);
}
this.getUnknownFields().writeTo(output);
}
示例2: writeTo
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
public void writeTo(CodedOutputStream output)
throws IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeUInt32(1, channelId_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBool(2, inheritAcls_);
}
for (int i = 0; i < groups_.size(); i++) {
output.writeMessage(3, groups_.get(i));
}
for (int i = 0; i < acls_.size(); i++) {
output.writeMessage(4, acls_.get(i));
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBool(5, query_);
}
getUnknownFields().writeTo(output);
}
示例3: writeToMap
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
/**
* Write to map.
*
* @param <K> the key type
* @param <V> the value type
* @param output the output
* @param order the order
* @param map the map
* @param keyType the key type
* @param defaultKey the default key
* @param valueType the value type
* @param defalutValue the defalut value
* @throws IOException Signals that an I/O exception has occurred.
*/
public static <K, V> void writeToMap(CodedOutputStream output, int order, Map<K, V> map,
com.google.protobuf.WireFormat.FieldType keyType, K defaultKey,
com.google.protobuf.WireFormat.FieldType valueType, V defalutValue) throws IOException {
com.baidu.bjf.remoting.protobuf.MapEntry<K, V> valuesDefaultEntry = com.baidu.bjf.remoting.protobuf.MapEntry
.<K, V> newDefaultInstance(null, keyType, defaultKey, valueType, defalutValue);
for (java.util.Map.Entry<K, V> entry : map.entrySet()) {
com.baidu.bjf.remoting.protobuf.MapEntry<K, V> values =
valuesDefaultEntry.newBuilderForType().setKey(entry.getKey()).setValue(entry.getValue()).build();
output.writeMessage(order, values);
}
}