当前位置: 首页>>代码示例>>Java>>正文


Java UnsupportedEncodingException.toString方法代码示例

本文整理汇总了Java中java.io.UnsupportedEncodingException.toString方法的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedEncodingException.toString方法的具体用法?Java UnsupportedEncodingException.toString怎么用?Java UnsupportedEncodingException.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.UnsupportedEncodingException的用法示例。


在下文中一共展示了UnsupportedEncodingException.toString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CertificateHolderReference

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
CertificateHolderReference(byte[] contents)
{
    try
    {
        String concat = new String(contents, ReferenceEncoding);

        this.countryCode = concat.substring(0, 2);
        this.holderMnemonic = concat.substring(2, concat.length() - 5);

        this.sequenceNumber = concat.substring(concat.length() - 5);
    }
    catch (UnsupportedEncodingException e)
    {
        throw new IllegalStateException(e.toString());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:CertificateHolderReference.java

示例2: digestString

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
 * Retrieves a byte sequence representing the MD5 digest of the
 * specified character sequence, using the specified encoding to
 * first convert the character sequence into a byte sequence.
 * If the specified encoding is null, then ISO-8859-1 is
 * assumed.
 *
 * @param string the string to digest.
 * @param encoding the character encoding.
 * @return the digest as an array of 16 bytes.
 * @throws HsqlUnsupportedOperationException if an MD5 digest
 *      algorithm is not available through the
 *      java.security.MessageDigest spi or the requested
 *      encoding is not available
 */
public static byte[] digestString(String string,
                                  String encoding)
                                  throws RuntimeException {

    byte[] data;

    if (encoding == null) {
        encoding = "ISO-8859-1";
    }

    try {
        data = string.getBytes(encoding);
    } catch (UnsupportedEncodingException x) {
        throw new RuntimeException(x.toString());
    }

    return digestBytes(data);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:MD5.java

示例3: getName

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public String getName(){
  if(name==null) return "";
  try {
    return new String(name, "ISO-8859-1");
  }
  catch (UnsupportedEncodingException e) {
    throw new InternalError(e.toString());
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:10,代码来源:GZIPHeader.java

示例4: getComment

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public String getComment(){
  if(comment==null) return "";
  try {
    return new String(comment, "ISO-8859-1");
  }
  catch (UnsupportedEncodingException e) {
    throw new InternalError(e.toString());
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:10,代码来源:GZIPHeader.java

示例5: getEncoded

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public byte[] getEncoded()
{
    String ref = countryCode + holderMnemonic + sequenceNumber;

    try
    {
        return ref.getBytes(ReferenceEncoding);
    }
    catch (UnsupportedEncodingException e)
    {
        throw new IllegalStateException(e.toString());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:14,代码来源:CertificateHolderReference.java

示例6: toBytes

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public static byte[] toBytes(String s) {
    try {
        return s.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e.toString(), e);
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:8,代码来源:Convert.java

示例7: toString

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public static String toString(byte[] bytes) {
    try {
        return new String(bytes, "UTF-8").trim();
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e.toString(), e);
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:8,代码来源:Convert.java

示例8: toString

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
@Override
public String toString() {
    try {
        StringBuilder result = new StringBuilder();
        boolean first = true;
        if (values.length == 0) {
            return URLEncoder.encode(name, "UTF-8");
        }
        for (String value : values) {
            if (first) {
                first = false;
            } else {
                result.append('&');
            }
            if (name != null) {
                result.append(URLEncoder.encode(name, "UTF-8"));
            }
            if (value != null) {
                result.append('=');
                result.append(URLEncoder.encode(value, "UTF-8"));
            }
        }
        return result.toString();
    } catch (UnsupportedEncodingException ex) {
        return ex.toString();
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:TestParameters.java

示例9: writeString

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
final void writeString(String s, String encoding, MySQLConnection conn) throws SQLException {
    ensureCapacity((s.length() * 3) + 1);
    try {
        writeStringNoNull(s, encoding, encoding, false, conn);
    } catch (UnsupportedEncodingException ue) {
        throw new SQLException(ue.toString(), SQLError.SQL_STATE_GENERAL_ERROR);
    }

    this.byteBuffer[this.position++] = 0;
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:11,代码来源:Buffer.java

示例10: ISO2GB

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
 * 转换编码 ISO-8859-1到GB2312
 * @param text
 * @return
 */
public static final String ISO2GB(String text) {
  String result = "";
  try {
    result = new String(text.getBytes("ISO-8859-1"), "GB2312");
  }
  catch (UnsupportedEncodingException ex) {
    result = ex.toString();
  }
  return result;
}
 
开发者ID:LuJiangLin,项目名称:TestDemo1-github,代码行数:16,代码来源:CharTools.java

示例11: getInputStream

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
    * Returns the input stream of the XML view.
    *
    * @return the input stream of the XML view
    */
   public InputStream getInputStream() {
// Turn StringBuffer into InputStream
       try {
           return new ByteArrayInputStream(buf.toString().getBytes("UTF-8"));
       } catch (UnsupportedEncodingException uee) {
    // should never happen
           throw new RuntimeException(uee.toString());
       }
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:PageDataImpl.java

示例12: OutputBufferThread

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
 * Creates a new OutputBufferThread to consume the given InputStream.
 * 
 * @param is InputStream to consume
 */
public OutputBufferThread(InputStream is) {
  this.setDaemon(true);
  output = new ArrayList<String>();
  try {
    reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException("Unsupported encoding " + e.toString());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:Exec.java

示例13: decode

import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
 * Decodes a URL safe string into its original form using the
 * specified character set. Escaped characters are converted back
 * to their original representation.
 *
 * This method is copied from the <b>Jakarta Commons Codec</b>;
 * <code>org.apache.commons.codec.net.URLCodec</code> class.
 *
 * @param string URL safe string to convert into its original form
 * @return original string
 * @throws IllegalArgumentException thrown if URL decoding is unsuccessful,
 */
public static String decode( String string, String charset ) {
    try {
        if (string == null) return null;

        return new String( decodeUrl( string.getBytes( "US-ASCII" ) ), charset );
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException( e.toString() );
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:HttpUnitUtils.java


注:本文中的java.io.UnsupportedEncodingException.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。