91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3.96MB
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發布日期: 2023-10-13
  • 語言: 其他
  • 標簽: protobuf??

資源簡介

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)?<????????|?((buf[2]?&?0xff)?<????????|?((buf[3]?&?0xff)?<??}

??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()));
???

評論

共有 條評論