當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。