本文整理汇总了Java中java.io.UnsupportedEncodingException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedEncodingException.getMessage方法的具体用法?Java UnsupportedEncodingException.getMessage怎么用?Java UnsupportedEncodingException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.UnsupportedEncodingException
的用法示例。
在下文中一共展示了UnsupportedEncodingException.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeValue
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* 字符转码
* @param aValue
* @return
* @see 转码后的字符串
*/
public static String decodeValue(String aValue)
{
if(aValue.trim().length() ==0)
{
return "";
}
String valueAfterTransCode = null;
try
{
valueAfterTransCode = URLDecoder.decode(aValue, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
e.getMessage();
}
return valueAfterTransCode;
}
示例2: utf8ToIso88591
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* UTF-8编码转换为ISO-9959-1
*
* @param str
* @return
*/
public static String utf8ToIso88591(String str) {
if (str == null) {
return str;
}
try {
return new String(str.getBytes("UTF-8"), "ISO-8859-1");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例3: iso88591ToUtf8
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* ISO-9959-1编码转换为UTF-8
*
* @param str
* @return
*/
public static String iso88591ToUtf8(String str) {
if (str == null) {
return str;
}
try {
return new String(str.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例4: decode
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* Decodes a URL safe string into its original form using the default string charset. Escaped characters are
* converted back to their original representation.
*
* @param str
* URL safe string to convert into its original form
* @return original string
* @throws DecoderException
* Thrown if URL decoding is unsuccessful
* @see #getDefaultCharset()
*/
@Override
public String decode(final String str) throws DecoderException {
if (str == null) {
return null;
}
try {
return decode(str, getDefaultCharset());
} catch (final UnsupportedEncodingException e) {
throw new DecoderException(e.getMessage(), e);
}
}
示例5: createField
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public TagField createField(Artwork artwork) throws FieldDataInvalidException
{
AbstractID3v2Frame frame = createFrame(getFrameAndSubIdFromGenericKey(FieldKey.COVER_ART).getFrameId());
FrameBodyAPIC body = (FrameBodyAPIC) frame.getBody();
if(!artwork.isLinked())
{
body.setObjectValue(DataTypes.OBJ_PICTURE_DATA, artwork.getBinaryData());
body.setObjectValue(DataTypes.OBJ_PICTURE_TYPE, artwork.getPictureType());
body.setObjectValue(DataTypes.OBJ_MIME_TYPE, artwork.getMimeType());
body.setObjectValue(DataTypes.OBJ_DESCRIPTION, "");
return frame;
}
else
{
try
{
body.setObjectValue(DataTypes.OBJ_PICTURE_DATA,artwork.getImageUrl().getBytes("ISO-8859-1"));
}
catch(UnsupportedEncodingException uoe)
{
throw new RuntimeException(uoe.getMessage());
}
body.setObjectValue(DataTypes.OBJ_PICTURE_TYPE, artwork.getPictureType());
body.setObjectValue(DataTypes.OBJ_MIME_TYPE, FrameBodyAPIC.IMAGE_IS_URL);
body.setObjectValue(DataTypes.OBJ_DESCRIPTION, "");
return frame;
}
}
示例6: getUrl
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public URL getUrl() {
try {
return URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":20880?" + Constants.APPLICATION_KEY + "=abc&" + Constants.SIDE_KEY + "=" + Constants.CONSUMER_SIDE + "&" + Constants.MONITOR_KEY + "=" + URLEncoder.encode("dubbo://" + NetUtils.getLocalHost() + ":7070", "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
示例7: decode
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public static String decode(String value) {
if (value == null || value.length() == 0) {
return "";
}
try {
return URLDecoder.decode(value, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例8: toString
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
protected String toString(byte[] data) throws ClassificationException {
try {
return new String(data, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new ClassificationException("UnsupportedEncodingException raised: " + e.getMessage());
}
}
示例9: encode
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public static String encode(String value) {
if (value == null || value.length() == 0) {
return "";
}
try {
return URLEncoder.encode(value, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例10: decode
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* Decodes a Base64 string into its original form. Escaped characters are converted back to their original
* representation.
*
* @param value
* Base64 string to convert into its original form
* @return original string
* @throws DecoderException
* A decoder exception is thrown if a failure condition is encountered during the decode process.
*/
public String decode(String value) throws DecoderException {
if (value == null) {
return null;
}
try {
return decodeText(value);
} catch (UnsupportedEncodingException e) {
throw new DecoderException(e.getMessage(), e);
}
}
示例11: createPatch
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* Create Patch Request
*/
public HttpPatch createPatch(String url, JSON data) {
HttpPatch patch = new HttpPatch(url);
patch.setHeader("Content-Type", "application/json");
String string = data.toString(1);
try {
patch.setEntity(new StringEntity(string, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
return patch;
}
示例12: toBytes
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* String转换为字节数组
*
* @param str
* @return
*/
private static byte[] toBytes(final String str) {
if (str == null) {
return null;
}
try {
return str.getBytes(Constants.ENCODING);
} catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例13: decode
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public static String decode(String value) {
if (value == null || value.length() == 0) {
return "";
}
try {
return URLDecoder.decode(value, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例14: createField
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public TagField createField(Artwork artwork) throws FieldDataInvalidException
{
AbstractID3v2Frame frame = createFrame(getFrameAndSubIdFromGenericKey(FieldKey.COVER_ART).getFrameId());
FrameBodyAPIC body = (FrameBodyAPIC) frame.getBody();
if(!artwork.isLinked())
{
body.setObjectValue(DataTypes.OBJ_PICTURE_DATA, artwork.getBinaryData());
body.setObjectValue(DataTypes.OBJ_PICTURE_TYPE, artwork.getPictureType());
body.setObjectValue(DataTypes.OBJ_MIME_TYPE, artwork.getMimeType());
body.setObjectValue(DataTypes.OBJ_DESCRIPTION, "");
return frame;
}
else
{
try
{
body.setObjectValue(DataTypes.OBJ_PICTURE_DATA,artwork.getImageUrl().getBytes("ISO-8859-1"));
}
catch(UnsupportedEncodingException uoe)
{
throw new RuntimeException(uoe.getMessage());
}
body.setObjectValue(DataTypes.OBJ_PICTURE_TYPE, artwork.getPictureType());
body.setObjectValue(DataTypes.OBJ_MIME_TYPE, FrameBodyAPIC.IMAGE_IS_URL);
body.setObjectValue(DataTypes.OBJ_DESCRIPTION, "");
return frame;
}
}
示例15: urlEncode
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* URL编码
*
* @param s
* @return
*/
public String urlEncode(String s) {
if (WakaUtils.string.isEmpty(s)) {
return "";
}
try {
return URLEncoder.encode(s, I18NConstants.DEFAULT_CHARSET);
} catch (UnsupportedEncodingException e) {
throw new ZhhrUtilException(e.getMessage(), e);
}
}