Example #1
0
 void addHeader(final String name, final Object value) {
   validateHeaderName0(name);
   String strVal = toString(value);
   validateHeaderValue(strVal);
   int h = hash(name);
   int i = index(h);
   addHeader0(h, i, name, strVal);
 }
Example #2
0
  void setHeader(final String name, final Iterable<?> values) {
    if (values == null) {
      throw new NullPointerException("values");
    }

    validateHeaderName0(name);

    int h = hash(name);
    int i = index(h);

    removeHeader0(h, i, name);
    for (Object v : values) {
      if (v == null) {
        break;
      }
      String strVal = toString(v);
      validateHeaderValue(strVal);
      addHeader0(h, i, name, strVal);
    }
  }