Masks the PRIVATE-TOKEN header value with "********".

@param s a String containing HTTP request info, usually logging info
@return a String with the PRIVATE-TOKEN header value masked with asterisks
514592
public static String maskPrivateToken(String s) {

        if (s == null || s.isEmpty()) {
            return (s);
        }

        return (s.replaceAll("PRIVATE\\-TOKEN\\: [\\S]*", "PRIVATE-TOKEN: ********"));
    }
1104988
public static String normalize(String s) {
    StringBuilder b = new StringBuilder();
    for (int i = 0; i < s.length(); i++)
      b.append(normalize(s.charAt(i)));
    return (b.toString());
  }
846587
@Trivial
    private static String decode(String s) {
        if (s == null) {
            return null;
        }
        return s.replace("%21", "!");
    }
36988
public static String urlEncode(String s) {
        try {
            return URLEncoder.encode(s, StandardCharsets.UTF_8.name());
        } catch (UnsupportedEncodingException e) {
            throw new IllegalStateException("get a jdk that actually supports utf-8", e);
        }
    }
678407
public static String urlNonFormEncode(final String s)
        {
        if (StringUtils.isBlank(s))
            {
            LOG.warn("Could not encode blank string");
            throw new IllegalArgumentException("Blank string");
            }
        try
            {
            // We use the HttpClient encoder because the java URLEncoder
            // class uses form encoding.
            return URIUtil.encodeQuery(s, "UTF-8");
            }
        catch (final URIException e)
            {
            LOG.error ("Could not encode: " + s, e);
            
            // This really should never happen.
            assert false;
            return s;
            }
        }
293687
private static String stringify(final String s) {
    final StringBuilder buf = new StringBuilder(1 + s.length() + 1);
    buf.append('"');
    HttpQuery.escapeJson(s, buf);  // Abusing this function gets the job done.
    buf.append('"');
    return buf.toString();
  }
43078
@Nullable
    private String getCredentials(String header) {
        if (header == null) {
            return null;
        }

        final int space = header.indexOf(' ');
        if (space <= 0) {
            return null;
        }

        final String method = header.substring(0, space);
        if (!prefix.equalsIgnoreCase(method)) {
            return null;
        }

        return header.substring(space + 1);
    }
618238
public static String capitalize(String s)
    {
        if (s == null || s.length() == 0)
        {
            return s;
        }
        char chars[] = s.toCharArray();
        chars[0] = Character.toUpperCase(chars[0]);
        return new String(chars);
    }
575461
public static String parseCharset(Map<String, String> headers) {
        return parseCharset(headers, HTTP.DEFAULT_CONTENT_CHARSET);
    }
928958
public static String obfuscate(String s)
    {
        StringBuffer buf = new StringBuffer();
        byte[] b = s.getBytes();
        
        synchronized(buf)
        {
            buf.append("OBF:");
            for (int i=0;i<b.length;i++)
            {
                byte b1 = b[i];
                byte b2 = b[s.length()-(i+1)];
                int i1= (int)b1+(int)b2+127;
                int i2= (int)b1-(int)b2+127;
                int i0=i1*256+i2;
                String x=Integer.toString(i0,36);

                switch(x.length())
                {
                  case 1:buf.append('0');
                  case 2:buf.append('0');
                  case 3:buf.append('0');
                  default:buf.append(x);
                }
            }
            return buf.toString();
        }
    }
732214
public static String toUpperFirstChar(final String s)
    {
        if (Character.isUpperCase(s.charAt(0)))
        {
            return s;
        }

        return Character.toUpperCase(s.charAt(0)) + s.substring(1);
    }
1022241
public String getHeader(String name) {
        name += ":";
        for (String header : headers) {
            if (name.regionMatches(true, 0, header, 0, name.length())) {
                return header.substring(name.length()).trim();
            }
        }
        return null;
    }
1071050
public static String capitalize (String s)
    {
        if (isBlank(s)) {
            return s;
        }
        char c = s.charAt(0);
        if (Character.isUpperCase(c)) {
            return s;
        } else {
            return String.valueOf(Character.toUpperCase(c)) + s.substring(1);
        }
    }
615491
public static String constructSimpleWildcardPattern(String s) {
        String result = escapeRegExCharacters(s);
        //we want to match any characters between dots
        //so what we do is replace \* in our escaped string
        //with [^\\.]+
        //reference http://www.regular-expressions.info/dot.html
        return result.replace("\\*", "[^\\\\.]+");
    }
1299503
public String getHeader(String name) {
		if(name == null) {
			throw new NullPointerException("header name is null");
		}
		try {
			return RFC2396UrlDecoder.decode(((javax.sip.address.SipURI) super.uri).getHeader(name));
		} catch (NullPointerException e) {
			return null;
		}
	}
952401
public static String urlDecode(String s) {
		if (s == null) {
			return "";
		}
		String decoded = s;
		try {
			decoded = URLDecoder.decode(s, Config.DEFAULT_ENCODING);
		} catch (UnsupportedEncodingException ex) {
			logger.error(null, ex);
		}
		return decoded;
	}
1239187
private String toNetscapeHeaderString() {
        StringBuilder sb = new StringBuilder();

        sb.append(getName() + "=" + getValue());

        return sb.toString();
    }