List of utility methods to do Charset Create
String | getCharsetName(String location) get Charset Name Matcher matcher = REMOTE_PATH_PATTERN.matcher(location); if (matcher.matches() && matcher.groupCount() > 2) { return Charset.forName(matcher.group(4)).name(); } else { return null; |
Charset | getCharsetOrDefault(String charsetName) get Charset Or Default Charset charset = null; if (Charset.isSupported(charsetName)) { charset = Charset.forName(charsetName); } else { charset = Charset.defaultCharset(); return charset; |
Charset | getDefaultCharset() get Default Charset String charsetName; try { charsetName = System.getProperty("file.encoding"); } catch (SecurityException e) { charsetName = null; if (charsetName == null) { charsetName = new InputStreamReader(System.in).getEncoding(); ... |
Charset | getDefaultCharset() Returns the system's default charset. if (defaultCharset == null) defaultCharset = Charset .forName(new InputStreamReader(new ByteArrayInputStream(new byte[0])).getEncoding()); return defaultCharset; |
String | getDefaultCharsetName() get Default Charset Name return Charset.defaultCharset().name();
|
Charset | getDefaultSystemCharset() get Default System Charset return Charset.forName(System.getProperty("file.encoding")); |
int | getEncodedStringLength(String str) get Encoded String Length return encodeString(str).length;
|
String | getEncodedUrl(String unEncodedUrl) get Encoded Url try { return URLEncoder.encode(unEncodedUrl, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException ex) { return ERR_ENCODE_STRING; |
CharsetEncoder | getEncoder() get Encoder CharsetEncoder encoder = (CharsetEncoder) getReference(encoderCache); if (encoder == null) { encoder = UTF8.newEncoder(); setReference(encoderCache, encoder); return encoder; |
CharsetEncoder | getEncoder() get Encoder SoftReference<CharsetEncoder> sr = encoder.get(); if (sr == null || sr.get() == null) { CharsetEncoder ce = UTF8_CHARSET.newEncoder(); encoder.set(new SoftReference<CharsetEncoder>(ce)); return ce; } else { return sr.get(); |