private static final byte lc(byte q) { return (byte) StringUtils.toLowerCase((char) (q & 0xff)); }
private static Charset charsetForAlias(String name) { return encodingAliases.get(StringUtils.toLowerCase(name)); }
@Override public boolean contains(Object needle) { if (needle instanceof String) { String n = (String) needle; return names.containsKey(n) || names.containsKey(StringUtils.toLowerCase(n)); } return false; }
private static boolean isSignedHeader(String name) { final String nameLC = StringUtils.toLowerCase(name); return SIGNED_HEADERS.contains(nameLC) || nameLC.startsWith("x-amz-"); //$NON-NLS-1$ }
private static String keyNameFor(String name) { StringBuilder r = new StringBuilder(name.length()); for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); if (c != '_') { r.append(c); } } return toLowerCase(r.toString()); }
Set<String> getSubsections(String section) { Map<String, Set<String>> m = names().subsections; Set<String> r = m.get(section); if (r == null) r = m.get(toLowerCase(section)); if (r == null) return Collections.emptySet(); return Collections.unmodifiableSet(r); }
/** * Compare two strings, ignoring case. * <p> * This method does not honor the JVM locale, but instead always behaves as * though it is in the US-ASCII locale. * * @param a * first string to compare. * @param b * second string to compare. * @since 2.0 * @return an int. */ public static int compareIgnoreCase(String a, String b) { for (int i = 0; i < a.length() && i < b.length(); i++) { int d = toLowerCase(a.charAt(i)) - toLowerCase(b.charAt(i)); if (d != 0) return d; } return a.length() - b.length(); }
/** * Test if two strings are equal, ignoring case. * <p> * This method does not honor the JVM locale, but instead always behaves as * though it is in the US-ASCII locale. * * @param a * first string to compare. * @param b * second string to compare. * @return true if a equals b */ public static boolean equalsIgnoreCase(String a, String b) { if (a == b) return true; if (a.length() != b.length()) return false; for (int i = 0; i < a.length(); i++) { if (toLowerCase(a.charAt(i)) != toLowerCase(b.charAt(i))) return false; } return true; }
@Nullable static ObjectChecker.ErrorType parse(String key) { return errors.get(toLowerCase(key)); }
/** @return camelCaseVersion of the name. */ public String getMessageId() { String n = name(); StringBuilder r = new StringBuilder(n.length()); for (int i = 0; i < n.length(); i++) { char c = n.charAt(i); if (c != '_') { r.append(StringUtils.toLowerCase(c)); } else { r.append(n.charAt(++i)); } } return r.toString(); } }
/** * Convert the input string to lower case, according to the "C" locale. * <p> * This method does not honor the JVM locale, but instead always behaves as * though it is in the US-ASCII locale. Only characters in the range 'A' * through 'Z' are converted, all other characters are left as-is, even if * they otherwise would have a lowercase character equivalent. * * @param in * the input string. Must not be null. * @return a copy of the input string, after converting characters in the * range 'A'..'Z' to 'a'..'z'. */ public static String toLowerCase(String in) { final StringBuilder r = new StringBuilder(in.length()); for (int i = 0; i < in.length(); i++) r.append(toLowerCase(in.charAt(i))); return r.toString(); }
SectionNames(ConfigSnapshot cfg) { Map<String, String> sec = new LinkedHashMap<>(); Map<String, Set<String>> sub = new HashMap<>(); while (cfg != null) { for (ConfigLine e : cfg.entryList) { if (e.section == null) continue; String l1 = toLowerCase(e.section); if (!sec.containsKey(l1)) sec.put(l1, e.section); if (e.subsection == null) continue; Set<String> m = sub.get(l1); if (m == null) { m = new LinkedHashSet<>(); sub.put(l1, m); } m.add(e.subsection); } cfg = cfg.baseState; } sections = new CaseFoldingSet(sec); subsections = sub; } }
switch (StringUtils.toLowerCase(n.charAt(n.length() - 1))) { case 'g': mul = Config.GiB;
private Map<String, String> getNamesInternal(String section, String subsection, boolean recursive) { List<ConfigLine> s = sorted(); int idx = find(s, section, subsection, ""); //$NON-NLS-1$ if (idx < 0) idx = -(idx + 1); Map<String, String> m = new LinkedHashMap<>(); while (idx < s.size()) { ConfigLine e = s.get(idx++); if (!e.match(section, subsection)) break; if (e.name == null) continue; String l = toLowerCase(e.name); if (!m.containsKey(l)) m.put(l, e.name); } if (recursive && baseState != null) m.putAll(baseState.getNamesInternal(section, subsection, recursive)); return m; }
final String hdr = entry.getKey(); if (isSignedHeader(hdr)) sigHdr.put(StringUtils.toLowerCase(hdr), toCleanString(entry.getValue()));
@Override public boolean contains(Object needle) { if (needle instanceof String) { String n = (String) needle; return names.containsKey(n) || names.containsKey(StringUtils.toLowerCase(n)); } return false; }
private static String keyNameFor(String name) { StringBuilder r = new StringBuilder(name.length()); for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); if (c != '_') { r.append(c); } } return toLowerCase(r.toString()); }
Set<String> getSubsections(String section) { Map<String, Set<String>> m = names().subsections; Set<String> r = m.get(section); if (r == null) r = m.get(toLowerCase(section)); if (r == null) return Collections.emptySet(); return Collections.unmodifiableSet(r); }
@Nullable static ObjectChecker.ErrorType parse(String key) { return errors.get(toLowerCase(key)); }
Set<String> getSubsections(String section) { Map<String, Set<String>> m = names().subsections; Set<String> r = m.get(section); if (r == null) r = m.get(toLowerCase(section)); if (r == null) return Collections.emptySet(); return Collections.unmodifiableSet(r); }