当前位置: 首页>>代码示例>>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;未经允许,请勿转载。