本文整理匯總了Java中com.google.protobuf.CodedOutputStream.writeInt32NoTag方法的典型用法代碼示例。如果您正苦於以下問題:Java CodedOutputStream.writeInt32NoTag方法的具體用法?Java CodedOutputStream.writeInt32NoTag怎麽用?Java CodedOutputStream.writeInt32NoTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.protobuf.CodedOutputStream
的用法示例。
在下文中一共展示了CodedOutputStream.writeInt32NoTag方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: serializeOneNestedSet
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
private void serializeOneNestedSet(
Object children, CodedOutputStream codedOut, Map<Object, byte[]> childToDigest)
throws IOException, SerializationException {
// Serialize nested set into an inner byte array so we can take its digest
ByteArrayOutputStream childOutputStream = new ByteArrayOutputStream();
HashingOutputStream hashingOutputStream =
new HashingOutputStream(Hashing.md5(), childOutputStream);
CodedOutputStream childCodedOut = CodedOutputStream.newInstance(hashingOutputStream);
if (children instanceof Object[]) {
serializeMultiItemChildArray((Object[]) children, childToDigest, childCodedOut);
} else if (children != NestedSet.EMPTY_CHILDREN) {
serializeSingleItemChildArray(children, childCodedOut);
} else {
// Empty set
childCodedOut.writeInt32NoTag(0);
}
childCodedOut.flush();
byte[] digest = hashingOutputStream.hash().asBytes();
codedOut.writeByteArrayNoTag(digest);
byte[] childBytes = childOutputStream.toByteArray();
codedOut.writeByteArrayNoTag(childBytes);
childToDigest.put(children, digest);
}
示例2: serializeMultiItemChildArray
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
private void serializeMultiItemChildArray(
Object[] children, Map<Object, byte[]> childToDigest, CodedOutputStream childCodedOut)
throws IOException, SerializationException {
childCodedOut.writeInt32NoTag(children.length);
for (Object child : children) {
if (child instanceof Object[]) {
byte[] digest =
Preconditions.checkNotNull(
childToDigest.get(child),
"Digest not available; Are nested sets serialized in the right order?");
childCodedOut.writeBoolNoTag(true);
childCodedOut.writeByteArrayNoTag(digest);
} else {
childCodedOut.writeBoolNoTag(false);
objectCodec.serialize(cast(child), childCodedOut);
}
}
}
示例3: serialize
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(NestedSet<T> obj, CodedOutputStream codedOut)
throws SerializationException, IOException {
// Topo sort the nested set to ensure digests are available for children at time of writing
Collection<Object> topoSortedChildren = getTopologicallySortedChildren(obj);
Map<Object, byte[]> childToDigest = new IdentityHashMap<>();
codedOut.writeInt32NoTag(topoSortedChildren.size());
orderCodec.serialize(obj.getOrder(), codedOut);
for (Object children : topoSortedChildren) {
serializeOneNestedSet(children, codedOut, childToDigest);
}
}
示例4: serialize
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(PathFragment pathFragment, CodedOutputStream codedOut)
throws IOException, SerializationException {
codedOut.writeInt32NoTag(pathFragment.getDriveLetter());
codedOut.writeBoolNoTag(pathFragment.isAbsolute());
codedOut.writeInt32NoTag(pathFragment.segmentCount());
for (int i = 0; i < pathFragment.segmentCount(); i++) {
stringCodec.serialize(pathFragment.getSegment(i), codedOut);
}
}
示例5: serialize
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(ImmutableList<T> list, CodedOutputStream codedOut)
throws SerializationException, IOException {
codedOut.writeInt32NoTag(list.size());
for (T item : list) {
codec.serialize(item, codedOut);
}
}
示例6: serialize
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(Key obj, CodedOutputStream codedOut)
throws SerializationException, IOException {
BuildOptions.CODEC.serialize(obj.buildOptions, codedOut);
codedOut.writeInt32NoTag(obj.fragments.fragmentClasses().size());
for (Class<? extends BuildConfiguration.Fragment> fragment :
obj.fragments.fragmentClasses()) {
StringCodecs.asciiOptimized().serialize(fragment.getName(), codedOut);
}
}
示例7: serialize
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(DottedVersion obj, CodedOutputStream codedOut) throws IOException {
codedOut.writeInt32NoTag(obj.components.size());
for (Component component : obj.components) {
component.serialize(codedOut);
}
codedOut.writeStringNoTag(obj.stringRepresentation);
codedOut.writeInt32NoTag(obj.numOriginalComponents);
}
示例8: serialize
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(
FileSystemProvider fsProvider, BuildConfiguration obj, CodedOutputStream codedOut)
throws SerializationException, IOException {
BlazeDirectories.CODEC.serialize(fsProvider, obj.directories, codedOut);
codedOut.writeInt32NoTag(obj.fragments.size());
for (Fragment fragment : obj.fragments.values()) {
Fragment.CODEC.serialize(fsProvider, fragment, codedOut);
}
BuildOptions.CODEC.serialize(obj.buildOptions, codedOut);
StringCodecs.asciiOptimized().serialize(obj.repositoryName, codedOut);
}
示例9: serialize
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(BuildOptions buildOptions, CodedOutputStream codedOut)
throws IOException, SerializationException {
Collection<FragmentOptions> fragmentOptions = buildOptions.getOptions();
codedOut.writeInt32NoTag(fragmentOptions.size());
for (FragmentOptions options : buildOptions.getOptions()) {
FragmentOptions.CODEC.serialize(options, codedOut);
}
}
示例10: serializeSingleItemChildArray
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
private void serializeSingleItemChildArray(Object children, CodedOutputStream childCodedOut)
throws IOException, SerializationException {
childCodedOut.writeInt32NoTag(1);
T singleChild = cast(children);
objectCodec.serialize(singleChild, childCodedOut);
}
示例11: serialize
import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(Integer obj, CodedOutputStream codedOut)
throws SerializationException, IOException {
codedOut.writeInt32NoTag(obj);
}