Package org.bardframework.commons.utils
Class CharsetUtils
- java.lang.Object
-
- org.bardframework.commons.utils.CharsetUtils
-
public final class CharsetUtils extends Object
Demonstrate default Charset-related details.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CharsetgetDefaultCharset()static StringgetDefaultEncoding()Supplies the default encoding without using Charset.defaultCharset() and without accessing System.getProperty("file.encoding").static LocalegetDefaultLocale()static StringgetFileEncoding()static StringgetSunEncoding()static CharsettoCharset(String charset)Returns a Charset for the named charset.static CharsettoCharset(Charset charset)Returns the given Charset or the default Charset if the given Charset is null.
-
-
-
Method Detail
-
toCharset
public static Charset toCharset(String charset)
Returns a Charset for the named charset. If the name is null, return the default Charset.- Parameters:
charset- The name of the requested charset, may be null.- Returns:
- a Charset for the named charset
- Throws:
UnsupportedCharsetException- If the named charset is unavailable
-
toCharset
public static Charset toCharset(Charset charset)
Returns the given Charset or the default Charset if the given Charset is null.- Parameters:
charset- A charset or null.- Returns:
- the given Charset or the default Charset if the given Charset is null
-
getDefaultEncoding
public static String getDefaultEncoding()
Supplies the default encoding without using Charset.defaultCharset() and without accessing System.getProperty("file.encoding").- Returns:
- Default encoding (default charset).
-
getDefaultLocale
public static Locale getDefaultLocale()
-
getDefaultCharset
public static Charset getDefaultCharset()
-
getSunEncoding
public static String getSunEncoding()
- Returns:
- sun.jnu.encoding
-
getFileEncoding
public static String getFileEncoding()
- Returns:
- file.encoding
-
-