private static void checkCharsetName(String name) { if (name.isEmpty()) { throw new IllegalCharsetNameException(name); } if (!isValidCharsetNameStart(name.charAt(0))) { throw new IllegalCharsetNameException(name); } for (int i = 1; i < name.length(); ++i) { if (!isValidCharsetNamePart(name.charAt(i))) { throw new IllegalCharsetNameException(name); } } }
public Connection.Request postDataCharset(String charset) { Validate.notNull(charset, "Charset must not be null"); if (!Charset.isSupported(charset)) throw new IllegalCharsetNameException(charset); this.postDataCharset = charset; return this; }
private void setEncoding(String name) { EncodingDB.Entry e = EncodingDB.getEncodings().get(Bytes.toBytes(name)); if (e != null) { encoding = e.getEncoding(); } else { throw new IllegalCharsetNameException(name); } } }
throw new IllegalCharsetNameException(null);
throw new IllegalCharsetNameException(name); return charset; } else if ("none".equals(lower) || "no".equals(lower)) { throw new IllegalCharsetNameException(name); } else { Matcher iso = ISO_NAME_PATTERN.matcher(lower);
private void setEncoding(String name) { EncodingDB.Entry e = EncodingDB.getEncodings().get(Bytes.toBytes(name)); if (e != null) { encoding = e.getEncoding(); } else { throw new IllegalCharsetNameException(name); } } }
/** * * @param icuCanonicalName * @param canonicalName * @param aliases * @stable ICU 3.6 */ protected CharsetICU(String icuCanonicalName, String canonicalName, String[] aliases) { super(canonicalName,aliases); if(canonicalName.length() == 0){ throw new IllegalCharsetNameException(canonicalName); } this.icuCanonicalName = icuCanonicalName; }
String getAsString() { try { return new String(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining(), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new IllegalCharsetNameException("UTF-8"); // won't happen. } }
private static void checkCharsetName(String name) { if (name.isEmpty()) { throw new IllegalCharsetNameException(name); } if (!isValidCharsetNameStart(name.charAt(0))) { throw new IllegalCharsetNameException(name); } for (int i = 1; i < name.length(); ++i) { if (!isValidCharsetNamePart(name.charAt(i))) { throw new IllegalCharsetNameException(name); } } }
/** * Checks that the given string is a legal charset name. </p> * * @param s * A purported charset name * * @throws IllegalCharsetNameException * If the given name is not a legal charset name */ private static void checkName(String s) { int n = s.length(); if (n == 0) throw new IllegalCharsetNameException(s); for (int i = 0; i < n; i++) { char c = s.charAt(i); if (c >= 'A' && c <= 'Z') continue; if (c >= 'a' && c <= 'z') continue; if (c >= '0' && c <= '9') continue; if (c == '-' && i != 0) continue; if (c == '+' && i != 0) continue; if (c == ':' && i != 0) continue; if (c == '_' && i != 0) continue; if (c == '.' && i != 0) continue; throw new IllegalCharsetNameException(s); } }
private static void checkCharsetName(String name) { if (name.isEmpty()) { throw new IllegalCharsetNameException(name); } if (!isValidCharsetNameStart(name.charAt(0))) { throw new IllegalCharsetNameException(name); } for (int i = 1; i < name.length(); ++i) { if (!isValidCharsetNamePart(name.charAt(i))) { throw new IllegalCharsetNameException(name); } } }
/** * Checks that the given string is a legal charset name. </p> * * @param s * A purported charset name * * @throws IllegalCharsetNameException * If the given name is not a legal charset name */ private static void checkName(String s) { int n = s.length(); if (n == 0) throw new IllegalCharsetNameException(s); for (int i = 0; i < n; i++) { char c = s.charAt(i); if (c >= 'A' && c <= 'Z') continue; if (c >= 'a' && c <= 'z') continue; if (c >= '0' && c <= '9') continue; if (c == '-' && i != 0) continue; if (c == '+' && i != 0) continue; if (c == ':' && i != 0) continue; if (c == '_' && i != 0) continue; if (c == '.' && i != 0) continue; throw new IllegalCharsetNameException(s); } }
private static void checkCharsetName(String name) { if (name.isEmpty()) { throw new IllegalCharsetNameException(name); } if (!isValidCharsetNameStart(name.charAt(0))) { throw new IllegalCharsetNameException(name); } for (int i = 1; i < name.length(); ++i) { if (!isValidCharsetNamePart(name.charAt(i))) { throw new IllegalCharsetNameException(name); } } }
private static void checkCharsetName(String name) { if (name.isEmpty()) { throw new IllegalCharsetNameException(name); } if (!isValidCharsetNameStart(name.charAt(0))) { throw new IllegalCharsetNameException(name); } for (int i = 1; i < name.length(); ++i) { if (!isValidCharsetNamePart(name.charAt(i))) { throw new IllegalCharsetNameException(name); } } }
private static void checkCharsetName(String name) { if (name.isEmpty()) { throw new IllegalCharsetNameException(name); } if (!isValidCharsetNameStart(name.charAt(0))) { throw new IllegalCharsetNameException(name); } for (int i = 1; i < name.length(); ++i) { if (!isValidCharsetNamePart(name.charAt(i))) { throw new IllegalCharsetNameException(name); } } }
private static void checkCharsetName(String name) { if (name.isEmpty()) { throw new IllegalCharsetNameException(name); } if (!isValidCharsetNameStart(name.charAt(0))) { throw new IllegalCharsetNameException(name); } for (int i = 1; i < name.length(); ++i) { if (!isValidCharsetNamePart(name.charAt(i))) { throw new IllegalCharsetNameException(name); } } }
public Connection.Request postDataCharset(String charset) { Validate.notNull(charset, "Charset must not be null"); if (!Charset.isSupported(charset)) throw new IllegalCharsetNameException(charset); this.postDataCharset = charset; return this; }
/** * Sets charset. * * @param charset the charset * @return the charset */ public GlobalConfigBuilder setCharset(String charset) { if (!Charset.isSupported(charset)) { throw new IllegalCharsetNameException(charset); } put(KEY_CHARSET, charset); return this; }
private void setEncoding(String name) { EncodingDB.Entry e = EncodingDB.getEncodings().get(Bytes.toBytes(name)); if (e != null) { encoding = e.getEncoding(); } else { throw new IllegalCharsetNameException(name); } } }
private void setEncoding(String name) { EncodingDB.Entry e = EncodingDB.getEncodings().get(Bytes.toBytes(name)); if (e != null) { encoding = e.getEncoding(); } else { throw new IllegalCharsetNameException(name); } } }