@Immutable public final class CharsetManager extends Object
| Modifier and Type | Method and Description |
|---|---|
static SortedMap<String,Charset> |
getAllCharsets() |
static byte[] |
getAsBytes(String sText,
Charset aCharset) |
static byte[] |
getAsBytes(String sText,
String sCharsetName)
Deprecated.
|
static String |
getAsString(byte[] aBuffer,
Charset aCharset) |
static String |
getAsString(byte[] aBuffer,
int nOfs,
int nLength,
Charset aCharset) |
static String |
getAsString(byte[] aBuffer,
int nOfs,
int nLength,
String sCharsetName)
Deprecated.
|
static String |
getAsString(byte[] aBuffer,
String sCharsetName)
Deprecated.
|
static String |
getAsStringInOtherCharset(String sText,
Charset aCurrentCharset,
Charset aNewCharset) |
static String |
getAsStringInOtherCharset(String sText,
String sCurrentCharset,
String sNewCharset)
Deprecated.
|
static Charset |
getCharsetFromName(String sCharsetName)
Resolve the charset by the specified name.
|
static Charset |
getCharsetFromNameOrNull(String sCharsetName)
Resolve the charset by the specified name.
|
static int |
getUTF8ByteCount(char c) |
static int |
getUTF8ByteCount(char[] aChars)
Get the number of bytes necessary to represent the passed char array as an
UTF-8 string.
|
static int |
getUTF8ByteCount(int c)
Get the number of bytes necessary to represent the passed character.
|
static int |
getUTF8ByteCount(String s)
Get the number of bytes necessary to represent the passed string as an
UTF-8 string.
|
@Nonnull public static Charset getCharsetFromName(@Nonnull@Nonempty String sCharsetName)
Charset.forName(String) is, that this method has no checked
exceptions but only unchecked exceptions.sCharsetName - The charset to be resolved. May neither be null nor
empty.IllegalArgumentException - If the charset could not be resolved.@Nullable public static Charset getCharsetFromNameOrNull(@Nullable String sCharsetName)
Charset.forName(String) is, that this method throws no exceptions.sCharsetName - The charset to be resolved. May be null or empty.null if no such charset was
found.@Nonnull @ReturnsImmutableObject public static SortedMap<String,Charset> getAllCharsets()
@Nonnull public static byte[] getAsBytes(@Nonnull String sText, @Nonnull Charset aCharset)
@Nonnull @Deprecated public static byte[] getAsBytes(@Nonnull String sText, @Nonnull@Nonempty String sCharsetName)
@Nullable @Deprecated public static String getAsStringInOtherCharset(@Nullable String sText, @Nonnull@Nonempty String sCurrentCharset, @Nonnull@Nonempty String sNewCharset)
@Nullable public static String getAsStringInOtherCharset(@Nullable String sText, @Nonnull Charset aCurrentCharset, @Nonnull Charset aNewCharset)
@Nonnull @Deprecated public static String getAsString(@Nonnull byte[] aBuffer, @Nonnull@Nonempty String sCharsetName)
@Nonnull @Deprecated public static String getAsString(@Nonnull byte[] aBuffer, @Nonnegative int nOfs, @Nonnegative int nLength, @Nonnull@Nonempty String sCharsetName)
@Nonnull public static String getAsString(@Nonnull byte[] aBuffer, @Nonnull Charset aCharset)
@Nonnull public static String getAsString(@Nonnull byte[] aBuffer, @Nonnegative int nOfs, @Nonnegative int nLength, @Nonnull Charset aCharset)
@Nonnegative public static int getUTF8ByteCount(@Nullable String s)
s - The string to count the length. May be null or empty.@Nonnegative public static int getUTF8ByteCount(@Nullable char[] aChars)
aChars - The characters to count the length. May be null or
empty.@Nonnegative public static int getUTF8ByteCount(char c)
@Nonnegative public static int getUTF8ByteCount(@Nonnegative int c)
c - The character to be evaluated.Copyright © 2006–2015 phloc systems. All rights reserved.