コード例 #1
0
 /** @param fieldNames a case-insensitive set of HTTP header field names. */
 @DSSource({DSSourceKind.SENSITIVE_UNCATEGORIZED})
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 13:02:32.335 -0500",
     hash_original_method = "DFF30A75B51A172BE4172930F32BB680",
     hash_generated_method = "F866F29DDC94BA144419BC2D0696D255")
 public RawHeaders getAll(Set<String> fieldNames) {
   RawHeaders result = new RawHeaders();
   for (int i = 0; i < namesAndValues.size(); i += 2) {
     String fieldName = namesAndValues.get(i);
     if (fieldNames.contains(fieldName)) {
       result.add(fieldName, namesAndValues.get(i + 1));
     }
   }
   return result;
 }
コード例 #2
0
 /**
  * Creates a new instance from the given map of fields to values. If present, the null field's
  * last element will be used to set the status line.
  */
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 13:02:32.343 -0500",
     hash_original_method = "0E3CF8DED99C22691F37852AF5C558BE",
     hash_generated_method = "8E4E60A8B3E52C05A5F8E58E2AF1D6EA")
 public static RawHeaders fromMultimap(Map<String, List<String>> map) {
   RawHeaders result = new RawHeaders();
   for (Entry<String, List<String>> entry : map.entrySet()) {
     String fieldName = entry.getKey();
     List<String> values = entry.getValue();
     if (fieldName != null) {
       result.addAll(fieldName, values);
     } else if (!values.isEmpty()) {
       result.setStatusLine(values.get(values.size() - 1));
     }
   }
   return result;
 }