Package org.apache.commons.lang3
Class Charsets
- java.lang.Object
-
- org.apache.commons.lang3.Charsets
-
class Charsets extends java.lang.Object
Internal use only.Provides utilities for
Charset
.Package private since Apache Commons IO already provides a Charsets because
Charset
is injava.nio.charset
.- Since:
- 3.10
-
-
Constructor Summary
Constructors Constructor Description Charsets()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.nio.charset.Charset
toCharset(java.lang.String charsetName)
Returns the givencharset
or the default Charset ifcharset
is null.(package private) static java.nio.charset.Charset
toCharset(java.nio.charset.Charset charset)
Returns the givencharset
or the default Charset ifcharset
is null.(package private) static java.lang.String
toCharsetName(java.lang.String charsetName)
Returns the givencharset
or the default Charset ifcharset
is null.
-
-
-
Method Detail
-
toCharset
static java.nio.charset.Charset toCharset(java.nio.charset.Charset charset)
Returns the givencharset
or the default Charset ifcharset
is null.- Parameters:
charset
- a Charset or null.- Returns:
- the given
charset
or the default Charset ifcharset
is null.
-
toCharset
static java.nio.charset.Charset toCharset(java.lang.String charsetName)
Returns the givencharset
or the default Charset ifcharset
is null.- Parameters:
charsetName
- a Charset or null.- Returns:
- the given
charset
or the default Charset ifcharset
is null. - Throws:
java.nio.charset.UnsupportedCharsetException
- If no support for the named charset is available in this instance of the Java virtual machine
-
toCharsetName
static java.lang.String toCharsetName(java.lang.String charsetName)
Returns the givencharset
or the default Charset ifcharset
is null.- Parameters:
charsetName
- a Charset or null.- Returns:
- the given
charset
or the default Charset ifcharset
is null.
-
-