资源简介
opencv编译附加组件所需库
代码片段和文件信息
import com.google.protobuf.ByteString;
import com.google.protobuf.CodedInputStream;
import com.google.protobuf.conformance.Conformance;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf_test_messages.proto3.TestMessagesProto3;
import com.google.protobuf.util.JsonFormat;
import com.google.protobuf.util.JsonFormat.TypeRegistry;
import java.io.IOException;
import java.nio.ByteBuffer;
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 enum BinaryDecoder {
BYTE_STRING_DECODER() {
@Override
public TestMessagesProto3.TestAllTypes parse(ByteString bytes)
throws InvalidProtocolBufferException {
return TestMessagesProto3.TestAllTypes.parseFrom(bytes);
}
}
BYTE_ARRAY_DECODER() {
@Override
public TestMessagesProto3.TestAllTypes parse(ByteString bytes)
throws InvalidProtocolBufferException {
return TestMessagesProto3.TestAllTypes.parseFrom(bytes.toByteArray());
}
}
ARRAY_BYTE_BUFFER_DECODER() {
@Override
public TestMessagesProto3.TestAllTypes parse(ByteString bytes)
throws InvalidProtocolBufferException {
ByteBuffer buffer = ByteBuffer.allocate(bytes.size());
bytes.copyTo(buffer);
buffer.flip();
try {
return TestMessagesProto3.TestAllTypes.parseFrom(CodedInputStream.newInstance(buffer));
} catch (InvalidProtocolBufferException e) {
throw e;
} catch (IOException e) {
throw new RuntimeException(
“ByteString based ByteBuffer should not throw IOException.“ e);
}
}
}
READONLY_ARRAY_BYTE_BUFFER_DECODER() {
@Override
public TestMessagesProto3.TestAllTypes parse(ByteString bytes)
throws InvalidProtocolBufferException {
try {
return TestMessagesProto3.TestAllTypes.parseFrom(
CodedInputStream.newInstance(bytes.asReadOnlyByteBuffer()));
- 上一篇:战德臣计算机思维导论mooc全部习题及答案解析
- 下一篇:商品管理系统完整版1.0
相关资源
- stm32移植protobufnanopb-0.3.8-windows-x86操作
- NetDemo.unitypackage
- protobuf3在vs2005中的使用
- unity-protobuf3
- protobuf vs版本
- protobuf3-layaair_AS3-master
- Unity + Socket + Protobuff+异步+粘包拆包断
- protobuf-2.6.1.tar.gz
- google protobuf 中文翻译
- 最新的 libprotobuf.lib、libprotoc.lib和pr
- protobuf-cpp-3.1.0.tar.gz 下载192823
- protobuf-cpp-3.1.0.tar.gz 配置文件
- ProtobufTool_Rect
- protobuf/thrift/avro-序列化性能测试工程
-
typesc
ript.zip - protobuf-2.6.0以及protoc.exe
- protobuf解析查看工具.zip
- Protobuf.Syntax.Hightlighting.v2.0.0.sublime-p
- 已废弃资源,demo不必,描述中有解决
- protoc-gen-lua protobuf
- 集成Protobuffer3到ToLua
- protobuf-2.4.1.tar.gz
- 将protobuf移植到32位单片机.pdf
- protobuf-dt
- Google的protobuf,可以安装
- protobuf-decoder-master.zip
- protoc3.5protobuf3;.5
- protobuf-net的代码生成工具ProtoGen
- protobuf-wireshark测试消息
- protobuf 协议文件生成器
评论
共有 条评论