當前位置: 首頁>>代碼示例>>Java>>正文


Java DecoderException.getMessage方法代碼示例

本文整理匯總了Java中org.apache.commons.codec.DecoderException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java DecoderException.getMessage方法的具體用法?Java DecoderException.getMessage怎麽用?Java DecoderException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.codec.DecoderException的用法示例。


在下文中一共展示了DecoderException.getMessage方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: unhex

import org.apache.commons.codec.DecoderException; //導入方法依賴的package包/類
public Encoder unhex() {
    try {
        data = new Hex().decode(data);
        return this;
    } catch (DecoderException e) {
        throw new BaseException(e, "Failed to convert data from hex: %s", e.getMessage());
    }
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:9,代碼來源:Encoder.java

示例2: compute

import org.apache.commons.codec.DecoderException; //導入方法依賴的package包/類
public Checksum compute(final String data, final TransferStatus status) throws ChecksumException {
    try {
        return this.compute(new ByteArrayInputStream(Hex.decodeHex(data.toCharArray())), status);
    }
    catch(DecoderException e) {
        throw new ChecksumException(LocaleFactory.localizedString("Checksum failure", "Error"), e.getMessage(), e);
    }
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:9,代碼來源:AbstractChecksumCompute.java

示例3: decode

import org.apache.commons.codec.DecoderException; //導入方法依賴的package包/類
/**
 * Unescape and decode a given string regarded as an escaped string with the
 * default protocol charset.
 *
 * @param escaped a string
 * @return the unescaped string
 * @throws HttpException if the string cannot be decoded (invalid)
 */
public static String decode(String escaped) throws HttpException {
    try {
        byte[] rawdata = URLCodec.decodeUrl(EncodingUtils.getAsciiBytes(escaped));
        return EncodingUtils.getString(rawdata, UTF8_CHARSET_NAME);
    } catch (DecoderException e) {
        throw new HttpException(e.getMessage());
    }
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:17,代碼來源:URIUtil.java

示例4: decode

import org.apache.commons.codec.DecoderException; //導入方法依賴的package包/類
public static byte[] decode(String hexString){
    try {
        return Hex.decodeHex(hexString.toCharArray());
    } catch (DecoderException e) {
        throw new DataDecodeException(e.getMessage(), e);
    }
}
 
開發者ID:bubicn,項目名稱:bubichain-sdk-java,代碼行數:8,代碼來源:HexUtils.java

示例5: handle

import org.apache.commons.codec.DecoderException; //導入方法依賴的package包/類
@Override
public void handle(HttpExchange t) throws IOException {
    try {
        InputStream is = t.getRequestBody();
        StringWriter writer = new StringWriter();
        IOUtils.copy(is, writer, "UTF-8");
        String theString = writer.toString();

        List<NameValuePair> params = URLEncodedUtils.parse(theString, Charset.forName("UTF-8"));

        IridiumMessage message = new IridiumMessage(params);

        logger.debug(message);

        if (message.data == null || message.data.isEmpty()) {
            logger.info(MessageFormat.format("Empty MO message received ''{0}''.", message.toString()));
        } else if (message.imei.equalsIgnoreCase(imei)) {
            MAVLinkPacket packet = message.getPacket();

            if (packet != null) {
                MAVLinkLogger.log(Level.INFO, "MO", packet);

                dst.sendMessage(packet);
            } else {
                logger.warn(MessageFormat.format("Invalid MAVLink message ''{0}''.", message.toString()));
            }
        } else {
            logger.warn(MessageFormat.format("Invalid IMEI ''{0}''.", message.imei));
        }

        //Send response
        String response = "";
        t.sendResponseHeaders(200, response.length());
        OutputStream os = t.getResponseBody();
        os.write(response.getBytes());
        os.close();
    } catch (DecoderException e) {
        logger.error(e.getMessage());
        throw new IOException(e.getMessage());
    }
}
 
開發者ID:envirover,項目名稱:SPLGroundControl,代碼行數:42,代碼來源:RockBlockHttpHandler.java

示例6: decode

import org.apache.commons.codec.DecoderException; //導入方法依賴的package包/類
/**
 * Decodes URI encoded string.
 * <p/>
 * This is a two mapping, one from URI characters to octets, and
 * subsequently a second from octets to original characters:
 * <p><blockquote><pre>
 *   URI character sequence->octet sequence->original character sequence
 * </pre></blockquote><p>
 * <p/>
 * A URI must be separated into its components before the escaped
 * characters within those components can be allowedly decoded.
 * <p/>
 * Notice that there is a chance that URI characters that are non UTF-8
 * may be parsed as valid UTF-8.  A recent non-scientific analysis found
 * that EUC encoded Japanese words had a 2.7% false reading; SJIS had a
 * 0.0005% false reading; other encoding such as ASCII or KOI-8 have a 0%
 * false reading.
 * <p/>
 * The percent "%" character always has the reserved purpose of being
 * the escape indicator, it must be escaped as "%25" in order to be used
 * as data within a URI.
 * <p/>
 * The unescape method is internally performed within this method.
 *
 * @param component the URI character sequence
 * @param charset   the protocol charset
 * @return original character sequence
 * @throws HttpException incomplete trailing escape pattern or unsupported
 *                       character encoding
 * @since 3.0
 */
protected static String decode(String component, String charset)
        throws HttpException {
    if (component == null) {
        throw new IllegalArgumentException("Component array of chars may not be null");
    }
    byte[] rawData;
    try {
        rawData = URLCodec.decodeUrl(EncodingUtils.getAsciiBytes(component));
    } catch (DecoderException e) {
        throw new HttpException(e.getMessage());
    }
    return EncodingUtils.getString(rawData, charset);
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:45,代碼來源:URI.java

示例7: decode

import org.apache.commons.codec.DecoderException; //導入方法依賴的package包/類
/**
 * Unescape and decode a given string regarded as an escaped string with the
 * default protocol charset.
 *
 * @param escaped a string
 * @return the unescaped string
 * 
 * @throws URIException if the string cannot be decoded (invalid)
 * 
 * @see URI#getDefaultProtocolCharset
 */
public static String decode(String escaped) throws URIException {
    try {
        byte[] rawdata = URLCodec.decodeUrl(EncodingUtil.getAsciiBytes(escaped));
        return EncodingUtil.getString(rawdata, URI.getDefaultProtocolCharset());
    } catch (DecoderException e) {
        throw new URIException(e.getMessage());
    }
}
 
開發者ID:jenkinsci,項目名稱:lib-commons-httpclient,代碼行數:20,代碼來源:URIUtil.java

示例8: decode

import org.apache.commons.codec.DecoderException; //導入方法依賴的package包/類
/**
 * Decodes URI encoded string.
 *
 * This is a two mapping, one from URI characters to octets, and
 * subsequently a second from octets to original characters:
 * <p><blockquote><pre>
 *   URI character sequence->octet sequence->original character sequence
 * </pre></blockquote><p>
 *
 * A URI must be separated into its components before the escaped
 * characters within those components can be allowedly decoded.
 * <p>
 * Notice that there is a chance that URI characters that are non UTF-8
 * may be parsed as valid UTF-8.  A recent non-scientific analysis found
 * that EUC encoded Japanese words had a 2.7% false reading; SJIS had a
 * 0.0005% false reading; other encoding such as ASCII or KOI-8 have a 0%
 * false reading.
 * <p>
 * The percent "%" character always has the reserved purpose of being
 * the escape indicator, it must be escaped as "%25" in order to be used
 * as data within a URI.
 * <p>
 * The unescape method is internally performed within this method.
 *
 * @param component the URI character sequence
 * @param charset the protocol charset
 * @return original character sequence
 * @throws URIException incomplete trailing escape pattern or unsupported
 * character encoding
 * 
 * @since 3.0
 */
protected static String decode(String component, String charset) 
    throws URIException {
    if (component == null) {
        throw new IllegalArgumentException("Component array of chars may not be null");
    }
    byte[] rawdata = null;
    try { 
        rawdata = URLCodec.decodeUrl(EncodingUtil.getAsciiBytes(component));
    } catch (DecoderException e) {
        throw new URIException(e.getMessage());
    }
    return EncodingUtil.getString(rawdata, charset);
}
 
開發者ID:jenkinsci,項目名稱:lib-commons-httpclient,代碼行數:46,代碼來源:URI.java


注:本文中的org.apache.commons.codec.DecoderException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。