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


Java Decoder类代码示例

本文整理汇总了Java中org.apache.commons.codec.Decoder的典型用法代码示例。如果您正苦于以下问题:Java Decoder类的具体用法?Java Decoder怎么用?Java Decoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testAsDecoder

import org.apache.commons.codec.Decoder; //导入依赖的package包/类
@Test
public void testAsDecoder() throws DecoderException {

    final Decoder decoder = (Decoder) RareDecoderProxy.newInstance();

    try {
        decoder.decode(null);
        Assert.fail("passed: <Object>decode(null)");
    } catch (final NullPointerException npe) {
        // expected
    }

    final Object expected = new Object();
    final Object actual = decoder.decode(expected);
    Assert.assertEquals(actual, expected);
}
 
开发者ID:jinahya,项目名称:commons-codec-proxies,代码行数:17,代码来源:RareDecoderProxyTest.java

示例2: testAsDecoder

import org.apache.commons.codec.Decoder; //导入依赖的package包/类
@Test
public void testAsDecoder() throws DecoderException {

    final Decoder decoder = (Decoder) RareBinaryDecoderProxy.newInstance();

    try {
        decoder.decode(null);
        Assert.fail("passed.<Object>decode(null)");
    } catch (final NullPointerException npe) {
        // expected
    }

    final Object expected = new byte[0];
    final Object actual = decoder.decode(expected);
    Assert.assertEquals(actual, expected);
}
 
开发者ID:jinahya,项目名称:commons-codec-proxies,代码行数:17,代码来源:RareBinaryDecoderProxyTest.java

示例3: testAsDecoder

import org.apache.commons.codec.Decoder; //导入依赖的package包/类
@Test
public void testAsDecoder() throws DecoderException {

    final Decoder decoder = (Decoder) RareStringDecoderProxy.newInstance();

    try {
        decoder.decode((Object) null);
        Assert.fail("passed: decode((Object) null)");
    } catch (final NullPointerException npe) {
        // expected
    }

    try {
        decoder.decode(new Object());
        Assert.fail("passed: decode(new Object())");
    } catch (final DecoderException de) {
        // expected;
    }

    final Object expected = "";
    final Object actual = decoder.decode(expected);
    Assert.assertEquals(actual, expected);
}
 
开发者ID:jinahya,项目名称:commons-codec-proxies,代码行数:24,代码来源:RareStringDecoderProxyTest.java

示例4: getDefaultDeployment

import org.apache.commons.codec.Decoder; //导入依赖的package包/类
protected static WebArchive getDefaultDeployment(TestContext context) {
    context.setAppEngineWebXmlFile("appengine-web-with-logging-properties.xml");
    WebArchive war = getTckDeployment(context);
    war.addClasses(LoggingTestBase.class, TestBase.class)
        // classes for Base64.isBase64()
        .addClasses(Base64.class, BaseNCodec.class)
        .addClasses(BinaryEncoder.class, Encoder.class)
        .addClasses(BinaryDecoder.class, Decoder.class)
        .addClasses(EncoderException.class, DecoderException.class)
        .addAsWebInfResource("currentTimeUsec.jsp")
        .addAsWebInfResource("doNothing.jsp")
        .addAsWebInfResource("storeTestData.jsp")
        .addAsWebInfResource("throwException.jsp")
        .addAsWebInfResource("log4j-test.properties")
        .addAsWebInfResource("logging-all.properties");
    return war;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:18,代码来源:LoggingTestBase.java

示例5: testDecoder

import org.apache.commons.codec.Decoder; //导入依赖的package包/类
/**
 * Tests to make sure Base64's implementation of the org.apache.commons.codec.Decoder
 * interface is behaving identical to commons-codec-1.3.jar.
 *
 * @throws DecoderException problem
 */
@Test
public void testDecoder() throws DecoderException {
    final Decoder dec = new Base64();
    for (int i = 0; i < STRINGS.length; i++) {
        if (STRINGS[i] != null) {
            final byte[] base64 = utf8(STRINGS[i]);
            final byte[] binary = BYTES[i];
            final boolean b = Arrays.equals(binary, (byte[]) dec.decode(base64));
            assertTrue("Decoder test-" + i, b);
        }
    }
}
 
开发者ID:ManfredTremmel,项目名称:gwt-commons-codec,代码行数:19,代码来源:Base64Codec13Test.java

示例6: testAsDecoder

import org.apache.commons.codec.Decoder; //导入依赖的package包/类
@Test
public void testAsDecoder() throws DecoderException {

    final Decoder decoder = (Decoder) HexBinaryDecoderProxy.newInstance();

    try {
        decoder.decode(null);
        Assert.fail("decode(null)");
    } catch (final NullPointerException npe) {
        // expected
    }

    final Object encoded = Tests.encodedBytes();
    final Object decoded = decoder.decode(encoded);
}
 
开发者ID:jinahya,项目名称:hex-codec,代码行数:16,代码来源:HexBinaryDecoderProxyTest.java

示例7: getHelperDeployment

import org.apache.commons.codec.Decoder; //导入依赖的package包/类
protected static WebArchive getHelperDeployment() {
    WebArchive war = getTckDeployment();
    war.addClass(DatastoreHelperTestBase.class)
        .addClasses(Base64.class, BaseNCodec.class)
        .addClasses(BinaryEncoder.class, Encoder.class)
        .addClasses(BinaryDecoder.class, Decoder.class)
        .addClasses(EncoderException.class, DecoderException.class);
    return war;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:10,代码来源:DatastoreHelperTestBase.java


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