protobuf-cpp-3.1.0.tar.gz 配置文件


替换路径类似:opencv_extraopencv_contrib-3.2.0modulesdnn.downloadbd5e3eed635a8d32e2b99658633815efv3.1.0目录下的protobuf-cpp-3.1.0.tar.gz(亲测有效)
资源截图
代码片段和文件信息

import com.google.protobuf.conformance.Conformance;
import com.google.protobuf.util.JsonFormat;
import com.google.protobuf.util.JsonFormat.TypeRegistry;
import com.google.protobuf.InvalidProtocolBufferException;

class ConformanceJava {
  private int testCount = 0;
  private TypeRegistry typeRegistry;

  private boolean readFromStdin(byte[] buf int len) throws Exception {
    int ofs = 0;
    while (len > 0) {
      int read = System.in.read(buf ofs len);
      if (read == -1) {
        return false;  // EOF
      }
      ofs += read;
      len -= read;
    }

    return true;
  }

  private void writeToStdout(byte[] buf) throws Exception {
    System.out.write(buf);
  }

  // Returns -1 on EOF (the actual values will always be positive).
  private int readLittleEndianIntFromStdin() throws Exception {
    byte[] buf = new byte[4];
    if (!readFromStdin(buf 4)) {
      return -1;
    }
    return (buf[0] & 0xff)
        | ((buf[1] & 0xff) << 8)
        | ((buf[2] & 0xff) << 16)
        | ((buf[3] & 0xff) << 24);
  }

  private void writeLittleEndianIntToStdout(int val) throws Exception {
    byte[] buf = new byte[4];
    buf[0] = (byte)val;
    buf[1] = (byte)(val >> 8);
    buf[2] = (byte)(val >> 16);
    buf[3] = (byte)(val >> 24);
    writeToStdout(buf);
  }

  private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) {
    Conformance.TestAllTypes testMessage;

    switch (request.getPayloadCase()) {
      case PROTOBUF_PAYLOAD: {
        try {
          testMessage = Conformance.TestAllTypes.parseFrom(request.getProtobufPayload());
        } catch (InvalidProtocolBufferException e) {
          return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build();
        }
        break;
      }
      case JSON_PAYLOAD: {
        try {
          Conformance.TestAllTypes.Builder builder = Conformance.TestAllTypes.newBuilder();
          JsonFormat.parser().usingTypeRegistry(typeRegistry)
              .merge(request.getJsonPayload() builder);
          testMessage = builder.build();
        } catch (InvalidProtocolBufferException e) {
          return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build();
        }
        break;
      }
      case PAYLOAD_NOT_SET: {
        throw new RuntimeException(“Request didn‘t have payload.“);
      }

      default: {
        throw new RuntimeException(“Unexpected payload case.“);
      }
    }

    switch (request.getRequestedOutputFormat()) {
      case UNSPECIFIED:
        throw new RuntimeException(“Unspecified output format.“);

      case PROTOBUF:
        return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(testMessage.toByteString()).build();

      case JSON:
        try {
          return Conformance.ConformanceResponse.newBuilder().setJsonPayload(
              JsonFormat.printer().usingTypeRegistry(typeRegistry).print(testMessage)).build();
        } catch (InvalidProtocolBufferException |

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-06-02 18:59  protobuf-3.1.0
     文件       45860  2016-09-24 10:13  protobuf-3.1.0aclocal.m4
     文件        5826  2016-09-24 10:13  protobuf-3.1.0ar-lib
     文件        1361  2016-09-24 09:16  protobuf-3.1.0autogen.sh
     目录           0  2016-09-24 10:25  protobuf-3.1.0enchmarks
     文件        4556  2016-09-24 09:16  protobuf-3.1.0enchmarksgenerate_datasets.cc
     文件        3009  2016-09-24 09:27  protobuf-3.1.0enchmarksMakefile.am
     文件       34636  2016-09-24 10:13  protobuf-3.1.0enchmarksMakefile.in
     文件       28810  2016-09-24 09:27  protobuf-3.1.0BUILD
     文件       65259  2016-09-24 09:37  protobuf-3.1.0CHANGES.txt
     目录           0  2016-09-24 10:25  protobuf-3.1.0cmake
     文件        6226  2016-09-24 09:16  protobuf-3.1.0cmakeCMakeLists.txt
     文件        2112  2016-09-24 09:16  protobuf-3.1.0cmakeexamples.cmake
     文件       14490  2016-09-24 09:27  protobuf-3.1.0cmakeextract_includes.bat.in
     文件        4643  2016-09-24 09:16  protobuf-3.1.0cmakeinstall.cmake
     文件        2067  2016-09-24 09:16  protobuf-3.1.0cmakelibprotobuf-lite.cmake
     文件        4183  2016-09-24 09:16  protobuf-3.1.0cmakelibprotobuf.cmake
     文件        7913  2016-09-24 09:16  protobuf-3.1.0cmakelibprotoc.cmake
     文件        2805  2016-09-24 09:16  protobuf-3.1.0cmakeprotobuf-config-version.cmake.in
     文件         341  2016-09-24 09:16  protobuf-3.1.0cmakeprotobuf-config.cmake.in
     文件        7310  2016-09-24 09:16  protobuf-3.1.0cmakeprotobuf-module.cmake.in
     文件         281  2016-09-24 09:16  protobuf-3.1.0cmakeprotobuf-options.cmake
     文件         173  2016-09-24 09:16  protobuf-3.1.0cmakeprotoc.cmake
     文件       12518  2016-09-24 09:16  protobuf-3.1.0cmakeREADME.md
     文件       10950  2016-09-24 09:27  protobuf-3.1.0cmake ests.cmake
     文件        7333  2016-09-24 10:13  protobuf-3.1.0compile
     文件       45297  2016-09-24 10:13  protobuf-3.1.0config.guess
     文件        3709  2016-09-24 10:13  protobuf-3.1.0config.h.in
     文件       35564  2016-09-24 10:13  protobuf-3.1.0config.sub
     文件      629588  2016-09-24 10:13  protobuf-3.1.0configure
     文件        6246  2016-09-24 10:12  protobuf-3.1.0configure.ac
............此处省略987个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)