public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         onChanged();
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             onChanged();
             return this;
           }
           break;
         }
       case 8:
         {
           bitField0_ |= 0x00000001;
           metalGive_ = input.readInt32();
           break;
         }
     }
   }
 }
  @Test
  public void testMoreUnknown() throws Exception {
    UnknownFieldSet unknownGroupLevel2 =
        UnknownFieldSet.newBuilder()
            .addField(16, UnknownFieldSet.Field.newBuilder().addVarint(566667).build())
            .build();

    UnknownFieldSet unknownGroup =
        UnknownFieldSet.newBuilder()
            .addField(11, UnknownFieldSet.Field.newBuilder().addVarint(566667).build())
            .addField(15, UnknownFieldSet.Field.newBuilder().addGroup(unknownGroupLevel2).build())
            .build();

    ByteString bs = ByteString.copyFromUtf8("testUnknown");
    OneString data =
        OneString.newBuilder()
            .setUnknownFields(
                UnknownFieldSet.newBuilder()
                    .addField(5, UnknownFieldSet.Field.newBuilder().addFixed32(999).build())
                    .addField(6, UnknownFieldSet.Field.newBuilder().addGroup(unknownGroup).build())
                    .addField(7, UnknownFieldSet.Field.newBuilder().addLengthDelimited(bs).build())
                    .build())
            .setData("12345")
            .build();

    String javaText = formatter.printToString(data);
    // System.out.println(javaText);
    OneString.Builder builder = OneString.newBuilder();
    formatter.merge(TextUtils.toInputStream(javaText), builder);
    assertEquals(data.getData(), builder.build().getData());
  }
Esempio n. 3
0
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         onChanged();
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             onChanged();
             return this;
           }
           break;
         }
       case 10:
         {
           com.example.tutorial.Test.test.Builder subBuilder =
               com.example.tutorial.Test.test.newBuilder();
           input.readMessage(subBuilder, extensionRegistry);
           addT(subBuilder.buildPartial());
           break;
         }
     }
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             return this;
           }
           break;
         }
       case 10:
         {
           setKey(input.readBytes());
           break;
         }
       case 18:
         {
           setValue(input.readBytes());
           break;
         }
     }
   }
 }
 @Override
 public String toString() {
   StringBuilder str = new StringBuilder();
   str.append(getNameString()).append(" for ").append(object);
   if (unknownFields != null) {
     str.append(" with unknown fields ").append(unknownFields.asMap().keySet());
   }
   return str.toString();
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         return this;
       default:
         {
           if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             return this;
           }
           break;
         }
       case 8:
         {
           setX(input.readUInt32());
           break;
         }
       case 16:
         {
           setY(input.readUInt32());
           break;
         }
       case 24:
         {
           int rawValue = input.readEnum();
           com.opera.core.systems.scope.protos.SystemInputProtos.MouseInfo.MouseButton value =
               com.opera.core.systems.scope.protos.SystemInputProtos.MouseInfo.MouseButton
                   .valueOf(rawValue);
           if (value == null) {
             unknownFields.mergeVarintField(3, rawValue);
           } else {
             setButton(value);
           }
           break;
         }
       case 32:
         {
           setNumClicks(input.readUInt32());
           break;
         }
       case 40:
         {
           setModifier(input.readUInt32());
           break;
         }
     }
   }
 }
Esempio n. 7
0
 @SuppressWarnings("unused")
 private SubscribeResp(
     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 8:
           {
             bitField0_ |= 0x00000001;
             subReqId_ = input.readInt32();
             break;
           }
         case 16:
           {
             bitField0_ |= 0x00000002;
             respCode_ = input.readInt32();
             break;
           }
         case 26:
           {
             bitField0_ |= 0x00000004;
             desc_ = input.readBytes();
             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();
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         onChanged();
         return this;
       default:
         {
           if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             onChanged();
             return this;
           }
           break;
         }
       case 10:
         {
           bitField0_ |= 0x00000001;
           restVersion_ = input.readBytes();
           break;
         }
       case 18:
         {
           bitField0_ |= 0x00000002;
           jvmVersion_ = input.readBytes();
           break;
         }
       case 26:
         {
           bitField0_ |= 0x00000004;
           osVersion_ = input.readBytes();
           break;
         }
       case 34:
         {
           bitField0_ |= 0x00000008;
           serverVersion_ = input.readBytes();
           break;
         }
       case 42:
         {
           bitField0_ |= 0x00000010;
           jerseyVersion_ = input.readBytes();
           break;
         }
     }
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             return this;
           }
           break;
         }
       case 10:
         {
           setAuthor(input.readString());
           break;
         }
       case 18:
         {
           org.waveprotocol.wave.federation.Proto.ProtocolHashedVersion.Builder subBuilder =
               org.waveprotocol.wave.federation.Proto.ProtocolHashedVersion.newBuilder();
           if (hasResultingVersion()) {
             subBuilder.mergeFrom(getResultingVersion());
           }
           input.readMessage(subBuilder, extensionRegistry);
           setResultingVersion(subBuilder.buildPartial());
           break;
         }
       case 24:
         {
           setApplicationTimestamp(input.readInt64());
           break;
         }
       case 34:
         {
           org.waveprotocol.wave.federation.Proto.ProtocolWaveletOperation.Builder subBuilder =
               org.waveprotocol.wave.federation.Proto.ProtocolWaveletOperation.newBuilder();
           input.readMessage(subBuilder, extensionRegistry);
           addOperation(subBuilder.buildPartial());
           break;
         }
     }
   }
 }
 private DeleteAssetResponse(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry) {
   this();
   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:
           {
             com.google.protobuf.ByteString bs = input.readBytes();
             bitField0_ |= 0x00000001;
             uid_ = bs;
             break;
           }
         case 18:
           {
             com.google.protobuf.ByteString bs = input.readBytes();
             bitField0_ |= 0x00000002;
             error_ = bs;
             break;
           }
       }
     }
   } catch (com.google.protobuf.InvalidProtocolBufferException e) {
     throw new RuntimeException(e.setUnfinishedMessage(this));
   } catch (java.io.IOException e) {
     throw new RuntimeException(
         new com.google.protobuf.InvalidProtocolBufferException(e.getMessage())
             .setUnfinishedMessage(this));
   } finally {
     this.unknownFields = unknownFields.build();
     makeExtensionsImmutable();
   }
 }
Esempio n. 11
0
 private ScriptedProvider(
     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 8:
           {
             bitField0_ |= 0x00000001;
             active_ = input.readBool();
             break;
           }
         case 16:
           {
             bitField0_ |= 0x00000002;
             stopping_ = input.readBool();
             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();
   }
 }
Esempio n. 12
0
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             return this;
           }
           break;
         }
       case 10:
         {
           jp.go.nict.langrid.client.protobuf.proto.CommonProtos.Header.Builder subBuilder =
               jp.go.nict.langrid.client.protobuf.proto.CommonProtos.Header.newBuilder();
           input.readMessage(subBuilder, extensionRegistry);
           addHeaders(subBuilder.buildPartial());
           break;
         }
       case 18:
         {
           jp.go.nict.langrid.client.protobuf.proto.CommonProtos.Fault.Builder subBuilder =
               jp.go.nict.langrid.client.protobuf.proto.CommonProtos.Fault.newBuilder();
           if (hasFault()) {
             subBuilder.mergeFrom(getFault());
           }
           input.readMessage(subBuilder, extensionRegistry);
           setFault(subBuilder.buildPartial());
           break;
         }
       case 26:
         {
           setResult(input.readString());
           break;
         }
     }
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         onChanged();
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             onChanged();
             return this;
           }
           break;
         }
       case 10:
         {
           ensureTaskIdsIsMutable();
           taskIds_.add(input.readBytes());
           break;
         }
       case 16:
         {
           ensureStepIsMutable();
           step_.add(input.readInt32());
           break;
         }
       case 18:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addStep(input.readInt32());
           }
           input.popLimit(limit);
           break;
         }
     }
   }
 }
 private static void handleUnknownFields(
     Record record, String fieldPath, DynamicMessage.Builder builder) throws IOException {
   String path = fieldPath.isEmpty() ? FORWARD_SLASH : fieldPath;
   String attribute =
       record.getHeader().getAttribute(ProtobufTypeUtil.PROTOBUF_UNKNOWN_FIELDS_PREFIX + path);
   if (attribute != null) {
     UnknownFieldSet.Builder unknownFieldBuilder = UnknownFieldSet.newBuilder();
     unknownFieldBuilder.mergeDelimitedFrom(
         new ByteArrayInputStream(
             org.apache.commons.codec.binary.Base64.decodeBase64(
                 attribute.getBytes(StandardCharsets.UTF_8))));
     UnknownFieldSet unknownFieldSet = unknownFieldBuilder.build();
     builder.setUnknownFields(unknownFieldSet);
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         onChanged();
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             onChanged();
             return this;
           }
           break;
         }
       case 8:
         {
           bitField0_ |= 0x00000001;
           type_ = input.readInt32();
           break;
         }
       case 16:
         {
           bitField0_ |= 0x00000002;
           gender_ = input.readInt32();
           break;
         }
       case 26:
         {
           com.xinqihd.sns.gameserver.proto.XinqiGoodsInfo.GoodsInfo.Builder subBuilder =
               com.xinqihd.sns.gameserver.proto.XinqiGoodsInfo.GoodsInfo.newBuilder();
           input.readMessage(subBuilder, extensionRegistry);
           addGoodsInfo(subBuilder.buildPartial());
           break;
         }
     }
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             return this;
           }
           break;
         }
       case 8:
         {
           setCallbackId(input.readSInt32());
           break;
         }
       case 16:
         {
           setOpCode(input.readInt32());
           break;
         }
       case 26:
         {
           com.alachisoft.tayzgrid.common.protobuf.DSUpdatedCallbackResultProtocol
                   .DSUpdatedCallbackResult.Builder
               subBuilder =
                   com.alachisoft.tayzgrid.common.protobuf.DSUpdatedCallbackResultProtocol
                       .DSUpdatedCallbackResult.newBuilder();
           input.readMessage(subBuilder, extensionRegistry);
           addResult(subBuilder.buildPartial());
           break;
         }
     }
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             return this;
           }
           break;
         }
       case 8:
         {
           setRequestId(input.readInt64());
           break;
         }
       case 18:
         {
           setCacheId(input.readString());
           break;
         }
       case 24:
         {
           setIsRunning(input.readBool());
           break;
         }
       case 32:
         {
           setIsDotnetClient(input.readBool());
           break;
         }
     }
   }
 }
Esempio n. 18
0
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             return this;
           }
           break;
         }
       case 8:
         {
           setRequestID(input.readUInt32());
           break;
         }
       case 16:
         {
           setWindowID(input.readUInt32());
           break;
         }
       case 26:
         {
           setTime(input.readString());
           break;
         }
       case 34:
         {
           setHeader(input.readString());
           break;
         }
     }
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         onChanged();
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             onChanged();
             return this;
           }
           break;
         }
       case 10:
         {
           ensureUserIdIsMutable();
           userId_.add(input.readBytes());
           break;
         }
       case 16:
         {
           ensureDeadIsMutable();
           dead_.add(input.readBool());
           break;
         }
       case 18:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addDead(input.readBool());
           }
           input.popLimit(limit);
           break;
         }
       case 24:
         {
           ensureAttackCountsIsMutable();
           attackCounts_.add(input.readInt32());
           break;
         }
       case 26:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addAttackCounts(input.readInt32());
           }
           input.popLimit(limit);
           break;
         }
       case 32:
         {
           ensureHitCountsIsMutable();
           hitCounts_.add(input.readInt32());
           break;
         }
       case 34:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addHitCounts(input.readInt32());
           }
           input.popLimit(limit);
           break;
         }
       case 40:
         {
           ensureDamageIsMutable();
           damage_.add(input.readInt32());
           break;
         }
       case 42:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addDamage(input.readInt32());
           }
           input.popLimit(limit);
           break;
         }
       case 48:
         {
           ensureKillCountsIsMutable();
           killCounts_.add(input.readInt32());
           break;
         }
       case 50:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addKillCounts(input.readInt32());
           }
           input.popLimit(limit);
           break;
         }
       case 56:
         {
           ensureUserToolsIsMutable();
           userTools_.add(input.readInt32());
           break;
         }
       case 58:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addUserTools(input.readInt32());
           }
           input.popLimit(limit);
           break;
         }
       case 64:
         {
           ensureUseSkillIsMutable();
           useSkill_.add(input.readInt32());
           break;
         }
       case 66:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addUseSkill(input.readInt32());
           }
           input.popLimit(limit);
           break;
         }
     }
   }
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         onChanged();
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             onChanged();
             return this;
           }
           break;
         }
       case 8:
         {
           bitField0_ |= 0x00000001;
           type_ = input.readInt32();
           break;
         }
       case 16:
         {
           ensureArgsIsMutable();
           args_.add(input.readInt32());
           break;
         }
       case 18:
         {
           int length = input.readRawVarint32();
           int limit = input.pushLimit(length);
           while (input.getBytesUntilLimit() > 0) {
             addArgs(input.readInt32());
           }
           input.popLimit(limit);
           break;
         }
       case 26:
         {
           com.xinqihd.sns.gameserver.proto.XinqiPropData.PropData.Builder subBuilder =
               com.xinqihd.sns.gameserver.proto.XinqiPropData.PropData.newBuilder();
           input.readMessage(subBuilder, extensionRegistry);
           addProps(subBuilder.buildPartial());
           break;
         }
       case 34:
         {
           com.xinqihd.sns.gameserver.proto.XinqiUserInfo.UserInfo.Builder subBuilder =
               com.xinqihd.sns.gameserver.proto.XinqiUserInfo.UserInfo.newBuilder();
           input.readMessage(subBuilder, extensionRegistry);
           addUserinfos(subBuilder.buildPartial());
           break;
         }
       case 42:
         {
           bitField0_ |= 0x00000010;
           message_ = input.readBytes();
           break;
         }
     }
   }
 }
 @java.lang.Override
 public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
   return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
 }
Esempio n. 22
0
 private ScriptedProvider(boolean noInit) {
   this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance();
 }
  /**
   * Converts a protobuf message to an SDC Record Field.
   *
   * @param record SDC Record to add field to
   * @param fieldPath location in record where to insert field.
   * @param descriptor protobuf descriptor instance
   * @param messageTypeToExtensionMap protobuf extensions map
   * @param message message to decode and insert into the specified field path
   * @return new Field instance representing the decoded message
   * @throws DataParserException
   */
  public static Field protobufToSdcField(
      Record record,
      String fieldPath,
      Descriptors.Descriptor descriptor,
      Map<String, Set<Descriptors.FieldDescriptor>> messageTypeToExtensionMap,
      Object message)
      throws DataParserException {
    Map<String, Field> sdcRecordMapFieldValue = new HashMap<>();

    // get all the expected fields from the proto file
    Map<String, Descriptors.FieldDescriptor> protobufFields = new LinkedHashMap<>();
    for (Descriptors.FieldDescriptor fieldDescriptor : descriptor.getFields()) {
      protobufFields.put(fieldDescriptor.getName(), fieldDescriptor);
    }

    // get all fields in the read message
    Map<Descriptors.FieldDescriptor, Object> values = ((DynamicMessage) message).getAllFields();

    // for every field present in the proto definition create an sdc field.
    for (Descriptors.FieldDescriptor fieldDescriptor : protobufFields.values()) {
      Object value = values.get(fieldDescriptor);
      sdcRecordMapFieldValue.put(
          fieldDescriptor.getName(),
          createField(record, fieldPath, fieldDescriptor, messageTypeToExtensionMap, value));
    }

    // handle applicable extensions for this message type
    if (messageTypeToExtensionMap.containsKey(descriptor.getFullName())) {
      for (Descriptors.FieldDescriptor fieldDescriptor :
          messageTypeToExtensionMap.get(descriptor.getFullName())) {
        if (values.containsKey(fieldDescriptor)) {
          Object value = values.get(fieldDescriptor);
          sdcRecordMapFieldValue.put(
              fieldDescriptor.getName(),
              createField(record, fieldPath, fieldDescriptor, messageTypeToExtensionMap, value));
        }
      }
    }

    // handle unknown fields
    // unknown fields can go into the record header
    UnknownFieldSet unknownFields = ((DynamicMessage) message).getUnknownFields();
    if (!unknownFields.asMap().isEmpty()) {
      ByteArrayOutputStream bOut = new ByteArrayOutputStream();
      try {
        unknownFields.writeDelimitedTo(bOut);
        bOut.flush();
        bOut.close();
      } catch (IOException e) {
        throw new DataParserException(Errors.PROTOBUF_10, e.toString(), e);
      }
      String path = fieldPath.isEmpty() ? FORWARD_SLASH : fieldPath;
      byte[] bytes = org.apache.commons.codec.binary.Base64.encodeBase64(bOut.toByteArray());
      record
          .getHeader()
          .setAttribute(
              PROTOBUF_UNKNOWN_FIELDS_PREFIX + path, new String(bytes, StandardCharsets.UTF_8));
    }

    return Field.create(sdcRecordMapFieldValue);
  }
Esempio n. 24
0
 private FileMeta(boolean noInit) {
   this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance();
 }
Esempio n. 25
0
 private FileMeta(
     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;
             fileId_ = input.readBytes();
             break;
           }
         case 18:
           {
             bitField0_ |= 0x00000002;
             fileName_ = input.readBytes();
             break;
           }
         case 24:
           {
             bitField0_ |= 0x00000004;
             fileSize_ = input.readInt64();
             break;
           }
         case 32:
           {
             bitField0_ |= 0x00000008;
             createTime_ = input.readInt64();
             break;
           }
         case 42:
           {
             bitField0_ |= 0x00000010;
             innerFileId_ = input.readBytes();
             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();
   }
 }
Esempio n. 26
0
 private PGuidePosts(boolean noInit) {
   this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance();
 }
 public Builder mergeFrom(
     com.google.protobuf.CodedInputStream input,
     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     throws java.io.IOException {
   com.google.protobuf.UnknownFieldSet.Builder unknownFields =
       com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields());
   while (true) {
     int tag = input.readTag();
     switch (tag) {
       case 0:
         this.setUnknownFields(unknownFields.build());
         onChanged();
         return this;
       default:
         {
           if (!parseUnknownField(
               input, unknownFields,
               extensionRegistry, tag)) {
             this.setUnknownFields(unknownFields.build());
             onChanged();
             return this;
           }
           break;
         }
       case 8:
         {
           bitField0_ |= 0x00000001;
           keycode_ = input.readInt32();
           break;
         }
       case 16:
         {
           bitField0_ |= 0x00000002;
           saleDate_ = input.readInt32();
           break;
         }
       case 24:
         {
           bitField0_ |= 0x00000004;
           quantity_ = input.readInt32();
           break;
         }
       case 32:
         {
           bitField0_ |= 0x00000008;
           price_ = input.readInt64();
           break;
         }
       case 40:
         {
           int rawValue = input.readEnum();
           net.sf.RecordEditor.ProtoBuf.re.Test.Sales3.StoreSales6SDEnums.SaleType value =
               net.sf.RecordEditor.ProtoBuf.re.Test.Sales3.StoreSales6SDEnums.SaleType.valueOf(
                   rawValue);
           if (value == null) {
             unknownFields.mergeVarintField(5, rawValue);
           } else {
             bitField0_ |= 0x00000010;
             saleType_ = value;
           }
           break;
         }
       case 48:
         {
           int rawValue = input.readEnum();
           net.sf.RecordEditor.ProtoBuf.re.Test.Sales3.StoreSales6SDEnums.PaymentType value =
               net.sf.RecordEditor.ProtoBuf.re.Test.Sales3.StoreSales6SDEnums.PaymentType
                   .valueOf(rawValue);
           if (value == null) {
             unknownFields.mergeVarintField(6, rawValue);
           } else {
             bitField0_ |= 0x00000020;
             paymentType_ = value;
           }
           break;
         }
     }
   }
 }
Esempio n. 28
0
 private SubscribeResp(boolean noInit) {
   this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance();
 }
Esempio n. 29
0
 private LogEntry(
     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 8:
           {
             bitField0_ |= 0x00000001;
             storeId_ = input.readUInt64();
             break;
           }
         case 16:
           {
             int rawValue = input.readEnum();
             com.cloudata.blockstore.IscsiProto.LogAction value =
                 com.cloudata.blockstore.IscsiProto.LogAction.valueOf(rawValue);
             if (value == null) {
               unknownFields.mergeVarintField(2, rawValue);
             } else {
               bitField0_ |= 0x00000002;
               action_ = value;
             }
             break;
           }
         case 26:
           {
             bitField0_ |= 0x00000004;
             key_ = input.readBytes();
             break;
           }
         case 34:
           {
             bitField0_ |= 0x00000008;
             value_ = input.readBytes();
             break;
           }
         case 40:
           {
             bitField0_ |= 0x00000010;
             incrementBy_ = input.readInt64();
             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();
   }
 }
Esempio n. 30
0
 private PGuidePosts(
     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:
           {
             if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
               guidePosts_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
               mutable_bitField0_ |= 0x00000001;
             }
             guidePosts_.add(input.readBytes());
             break;
           }
         case 16:
           {
             bitField0_ |= 0x00000001;
             byteCount_ = input.readInt64();
             break;
           }
         case 24:
           {
             bitField0_ |= 0x00000002;
             rowCount_ = input.readInt64();
             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 {
     if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
       guidePosts_ = java.util.Collections.unmodifiableList(guidePosts_);
     }
     this.unknownFields = unknownFields.build();
     makeExtensionsImmutable();
   }
 }