docs: public static String extractQuotedValueFromHeader(final String header, final String key) {
  
          int keypos = 0;
          int pos = -1;
          boolean whiteSpace = true;
          boolean inQuotes = false;
          for (int i = 0; i < header.length() - 1; ++i) { //-1 because we need room for the = at the end
              //TODO: a more efficient matching algorithm
              char c = header.charAt(i);
              if (inQuotes) {
                  if (c == '"') {
                      inQuotes = false;
                  }
              } else {
                  if (key.charAt(keypos) == c && (whiteSpace || keypos > 0)) {
                      keypos++;
                      whiteSpace = false;
                  } else if (c == '"') {
                      keypos = 0;
                      inQuotes = true;
                      whiteSpace = false;
                  } else {
                      keypos = 0;
                      whiteSpace = c == ' ' || c == ';' || c == '\t';
                  }
                  if (keypos == key.length()) {
                      if (header.charAt(i + 1) == '=') {
                          pos = i + 2;
                          break;
                      } else {
                          keypos = 0;
                      }
                  }
              }
  
          }
          if (pos == -1) {
              return null;
          }
  
          int end;
          int start = pos;
          if (header.charAt(start) == '"') {
              start++;
              for (end = start; end < header.length(); ++end) {
                  char c = header.charAt(end);
                  if (c == '"') {
                      break;
                  }
              }
              return header.substring(start, end);
  
          } else {
              //no quotes
              for (end = start; end < header.length(); ++end) {
                  char c = header.charAt(end);
                  if (c == ' ' || c == '\t' || c == ';') {
                      break;
                  }
              }
              return header.substring(start, end);
          }
      }