|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ICheckedCharset
Specifies the interface of objects that represents a character encoding name that has already been checked if it is supported by the platform.
It helps to avoid the annoying try-catch code-pollution every time you use a valid encoding, but the API requires the handling of UnsupportedEncodingException even if it cannot occur at all.
| Method Summary | |
|---|---|
byte[] |
getBytes(java.lang.String string)
Returns the bytes of the given string as array encoded to the charset this instance represents, avoiding the unnecessary exception handling (UnsupportedEncodingException). |
java.nio.charset.Charset |
getCharset()
Returns the corresponding charset object. |
java.lang.String |
getName()
Returns the pure upper case encoding name (e.g. |
java.lang.String |
newString(byte[] bytes)
Returns a new String initialized with the given bytes which are expected to be encoded according to the character set this instance represents, avoiding the unnecessary exception handling (UnsupportedEncodingException). |
| Method Detail |
|---|
java.lang.String getName()
java.nio.charset.Charset getCharset()
java.lang.String newString(byte[] bytes)
It is the same like: new String(bytes, checkedCharsetName.toString());
bytes - The byte to create a string from.
byte[] getBytes(java.lang.String string)
string - The string to be converted to a byte array using this instance's charset.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||