當前位置: 首頁>>代碼示例>>Java>>正文


Java CodedOutputStream.writeBoolNoTag方法代碼示例

本文整理匯總了Java中com.google.protobuf.CodedOutputStream.writeBoolNoTag方法的典型用法代碼示例。如果您正苦於以下問題:Java CodedOutputStream.writeBoolNoTag方法的具體用法?Java CodedOutputStream.writeBoolNoTag怎麽用?Java CodedOutputStream.writeBoolNoTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.protobuf.CodedOutputStream的用法示例。


在下文中一共展示了CodedOutputStream.writeBoolNoTag方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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);
    }
  }
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:19,代碼來源:NestedSetCodec.java

示例2: serialize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(SkylarkSemantics semantics, CodedOutputStream codedOut)
    throws SerializationException, IOException {
  // <== Add new options here in alphabetic order ==>
  codedOut.writeBoolNoTag(semantics.incompatibleBzlDisallowLoadAfterStatement());
  codedOut.writeBoolNoTag(semantics.incompatibleCheckedArithmetic());
  codedOut.writeBoolNoTag(semantics.incompatibleComprehensionVariablesDoNotLeak());
  codedOut.writeBoolNoTag(semantics.incompatibleDepsetIsNotIterable());
  codedOut.writeBoolNoTag(semantics.incompatibleDepsetUnion());
  codedOut.writeBoolNoTag(semantics.incompatibleDictLiteralHasNoDuplicates());
  codedOut.writeBoolNoTag(semantics.incompatibleDisableGlobTracking());
  codedOut.writeBoolNoTag(semantics.incompatibleDisallowDictPlus());
  codedOut.writeBoolNoTag(semantics.incompatibleDisallowKeywordOnlyArgs());
  codedOut.writeBoolNoTag(semantics.incompatibleDisallowToplevelIfStatement());
  codedOut.writeBoolNoTag(semantics.incompatibleDisallowUncalledSetConstructor());
  codedOut.writeBoolNoTag(semantics.incompatibleLoadArgumentIsLabel());
  codedOut.writeBoolNoTag(semantics.incompatibleNewActionsApi());
  codedOut.writeBoolNoTag(semantics.incompatibleShowAllPrintMessages());
  codedOut.writeBoolNoTag(semantics.incompatibleStringIsNotIterable());
  codedOut.writeBoolNoTag(semantics.internalSkylarkFlagTestCanary());
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:22,代碼來源:SkylarkSemanticsCodec.java

示例3: serialize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(FileSystemProvider dependency, Root obj, CodedOutputStream codedOut)
    throws SerializationException, IOException {
  if (obj instanceof PathRoot) {
    codedOut.writeBoolNoTag(false);
    Path.CODEC.serialize(dependency, ((PathRoot) obj).path, codedOut);
  } else if (obj instanceof AbsoluteRoot) {
    Preconditions.checkArgument(((AbsoluteRoot) obj).fileSystem == dependency.getFileSystem());
    codedOut.writeBoolNoTag(true);
  } else {
    throw new AssertionError("Unknown Root subclass: " + obj.getClass().getName());
  }
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:14,代碼來源:Root.java

示例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);
  }
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:11,代碼來源:PathFragment.java

示例5: serializeNullable

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
public static <T> void serializeNullable(T obj, CodedOutputStream out, ObjectCodec<T> codec)
    throws IOException, SerializationException {
  if (obj == null) {
    out.writeBoolNoTag(false);
  } else {
    out.writeBoolNoTag(true);
    codec.serialize(obj, out);
  }
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:10,代碼來源:SerializationCommonUtils.java

示例6: serialize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
/**
 * Serializes a polymorphic type.
 *
 * @param dependency if null, it means that the parent, polymorphic type, provides no dependency.
 *     It is valid for dependency to be non-null, with an enclosed null value. This means that
 *     dependency itself is null (as opposed to non-existent).
 */
@SuppressWarnings("unchecked")
public static void serialize(
    Object input, CodedOutputStream codedOut, @Nullable Optional<?> dependency)
    throws IOException, SerializationException {
  if (input != null) {
    Class<?> clazz = input.getClass();
    try {
      Object codec = getCodec(clazz);
      codedOut.writeBoolNoTag(true);
      StringCodecs.asciiOptimized().serialize(clazz.getName(), codedOut);
      if (codec instanceof ObjectCodec) {
        ((ObjectCodec) codec).serialize(input, codedOut);
      } else if (codec instanceof InjectingObjectCodec) {
        if (dependency == null) {
          throw new SerializationException(
              clazz.getCanonicalName() + " serialize parent class lacks required dependency.");
        }
        ((InjectingObjectCodec) codec).serialize(dependency.orElse(null), input, codedOut);
      } else {
        throw new SerializationException(
            clazz.getCanonicalName()
                + ".CODEC has unexpected type "
                + codec.getClass().getCanonicalName());
      }
    } catch (ReflectiveOperationException e) {
      throw new SerializationException(input.getClass().getName(), e);
    }
  } else {
    codedOut.writeBoolNoTag(false);
  }
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:39,代碼來源:PolymorphicHelper.java

示例7: serialize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(ConfiguredTargetKey obj, CodedOutputStream codedOut)
    throws SerializationException, IOException {
  Label.CODEC.serialize(obj.label, codedOut);
  if (obj.configurationKey == null) {
    codedOut.writeBoolNoTag(false);
  } else {
    codedOut.writeBoolNoTag(true);
    BuildConfigurationValue.Key.CODEC.serialize(obj.configurationKey, codedOut);
  }
  codedOut.writeBoolNoTag(obj.isHostConfiguration());
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:13,代碼來源:ConfiguredTargetKey.java

示例8: serialize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(AspectKey obj, CodedOutputStream codedOut)
    throws SerializationException, IOException {
  Label.CODEC.serialize(obj.label, codedOut);
  ConfiguredTargetKey.CODEC.serialize(obj.baseConfiguredTargetKey, codedOut);
  listCodec.serialize(obj.baseKeys, codedOut);
  AspectDescriptor.CODEC.serialize(obj.aspectDescriptor, codedOut);
  Key.CODEC.serialize(obj.aspectConfigurationKey, codedOut);
  codedOut.writeBoolNoTag(obj.aspectConfigurationIsHost());
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:11,代碼來源:AspectValue.java

示例9: serialize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(GlobDescriptor globDesc, CodedOutputStream codedOut)
    throws IOException, SerializationException {
  packageIdCodec.serialize(globDesc.getPackageId(), codedOut);
  rootCodec.serialize(globDesc.getPackageRoot(), codedOut);
  PathFragment.CODEC.serialize(globDesc.getSubdir(), codedOut);
  stringCodec.serialize(globDesc.getPattern(), codedOut);
  codedOut.writeBoolNoTag(globDesc.excludeDirs());
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:10,代碼來源:GlobDescriptor.java

示例10: serialize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
void serialize(CodedOutputStream out) throws IOException {
  if (alphaSequence == null) {
    out.writeBoolNoTag(false);
  } else {
    out.writeBoolNoTag(true);
    out.writeStringNoTag(alphaSequence);
  }
  out.writeInt32NoTag(firstNumber);
  out.writeInt32NoTag(secondNumber);
  out.writeStringNoTag(stringRepresentation);
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:12,代碼來源:DottedVersion.java

示例11: serialize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
@Override
public void serialize(RepositoryName repoName, CodedOutputStream codedOut) throws IOException {
  boolean isMain = repoName.isMain();
  // Main is by far the most common. Use boolean to short-circuit string encoding on
  // serialization and byte[]/ByteString creation on deserialization.
  codedOut.writeBoolNoTag(isMain);
  if (!isMain) {
    codedOut.writeStringNoTag(repoName.getName());
  }
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:11,代碼來源:RepositoryNameCodec.java


注:本文中的com.google.protobuf.CodedOutputStream.writeBoolNoTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。