本文整理汇总了Java中org.apache.commons.codec.Decoder.decode方法的典型用法代码示例。如果您正苦于以下问题:Java Decoder.decode方法的具体用法?Java Decoder.decode怎么用?Java Decoder.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.codec.Decoder
的用法示例。
在下文中一共展示了Decoder.decode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例4: 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);
}