コード例 #1
0
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getIdBytes());
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getOpBytes());
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getCpBytes());
      }
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, timeout_);
      }
      if (((bitField0_ & 0x00000010) == 0x00000010)) {
        size += com.google.protobuf.CodedOutputStream.computeBytesSize(5, getMessageBytes());
      }
      if (((bitField0_ & 0x00000020) == 0x00000020)) {
        size += com.google.protobuf.CodedOutputStream.computeEnumSize(7, type_.getNumber());
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }
コード例 #2
0
 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
   getSerializedSize();
   if (((bitField0_ & 0x00000001) == 0x00000001)) {
     output.writeBytes(1, getIdBytes());
   }
   if (((bitField0_ & 0x00000002) == 0x00000002)) {
     output.writeBytes(2, getOpBytes());
   }
   if (((bitField0_ & 0x00000004) == 0x00000004)) {
     output.writeBytes(3, getCpBytes());
   }
   if (((bitField0_ & 0x00000008) == 0x00000008)) {
     output.writeInt32(4, timeout_);
   }
   if (((bitField0_ & 0x00000010) == 0x00000010)) {
     output.writeBytes(5, getMessageBytes());
   }
   if (((bitField0_ & 0x00000020) == 0x00000020)) {
     output.writeEnum(7, type_.getNumber());
   }
   getUnknownFields().writeTo(output);
 }
コード例 #3
0
 private Request(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws com.google.protobuf.InvalidProtocolBufferException {
   initFields();
   int mutable_bitField0_ = 0;
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder();
   try {
     boolean done = false;
     while (!done) {
       int tag = input.readTag();
       switch (tag) {
         case 0:
           done = true;
           break;
         default:
           {
             if (!parseUnknownField(
                 input, unknownFields,
                 extensionRegistry, tag)) {
               done = true;
             }
             break;
           }
         case 10:
           {
             bitField0_ |= 0x00000001;
             id_ = input.readBytes();
             break;
           }
         case 18:
           {
             bitField0_ |= 0x00000002;
             op_ = input.readBytes();
             break;
           }
         case 26:
           {
             bitField0_ |= 0x00000004;
             cp_ = input.readBytes();
             break;
           }
         case 32:
           {
             bitField0_ |= 0x00000008;
             timeout_ = input.readInt32();
             break;
           }
         case 42:
           {
             bitField0_ |= 0x00000010;
             message_ = input.readBytes();
             break;
           }
         case 56:
           {
             int rawValue = input.readEnum();
             com.crovate.message.ProtoBuffRequest.Request.RequestType value =
                 com.crovate.message.ProtoBuffRequest.Request.RequestType.valueOf(rawValue);
             if (value == null) {
               unknownFields.mergeVarintField(7, rawValue);
             } else {
               bitField0_ |= 0x00000020;
               type_ = value;
             }
             break;
           }
       }
     }
   } catch (com.google.protobuf.InvalidProtocolBufferException e) {
     throw e.setUnfinishedMessage(this);
   } catch (java.io.IOException e) {
     throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage())
         .setUnfinishedMessage(this);
   } finally {
     this.unknownFields = unknownFields.build();
     makeExtensionsImmutable();
   }
 }