示例#1
0
 public List<JsonStream> readStreamRepeated(
     JSONObject jsonObject, String fieldLabel, int fieldNumber)
     throws InvalidProtocolBufferException {
   List<JsonStream> fieldStreamRepeated = null;
   if (jsonObject != null) {
     JSONValue fieldValue = jsonObject.get(fieldLabel);
     if (fieldValue != null) {
       JSONArray fieldJSONArray = jsonValueToArray(fieldValue);
       if (fieldJSONArray != null) {
         fieldStreamRepeated = new ArrayList<JsonStream>();
         for (int i = 0; i < fieldJSONArray.size(); ++i) {
           JsonStream fieldStream = null;
           JSONObject fieldJSONObject = jsonValueToObject(fieldJSONArray.get(i));
           if (fieldJSONObject != null) {
             fieldStream = this.newStream(fieldJSONObject);
           }
           if (fieldStream != null) {
             fieldStreamRepeated.add(fieldStream);
           } else {
             throw InvalidProtocolBufferException.failedToReadObjectRepeated(fieldLabel);
           }
         }
       } else {
         throw InvalidProtocolBufferException.failedToReadObjectRepeated(fieldLabel);
       }
     }
   }
   return fieldStreamRepeated;
 }