本文整理汇总了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);
}
示例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: 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;
}
示例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);
}
}
}
示例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);
}
示例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;
}