List of usage examples for org.apache.commons.codec StringDecoder decode
String decode(String pString) throws DecoderException;
From source file:com.github.jinahya.codec.commons.RareStringDecoderProxyTest.java
@Test public void testAsStringDecoder() throws DecoderException { final StringDecoder decoder = (StringDecoder) RareStringDecoderProxy.newInstance(); try {//from w w w.j ava 2 s. c om decoder.decode((String) null); Assert.fail("passed: decode((String) null)"); } catch (final NullPointerException npe) { // expected } final String expected = ""; final String actual = decoder.decode(expected); Assert.assertEquals(actual, expected); }
From source file:org.apache.abdera2.common.text.Codec.java
public static String decode(String value) { if (value == null) return null; for (StringDecoder dec : codecs) { try {//from w ww .j a v a2 s. co m return dec.decode(value); } catch (DecoderException de) { } catch (Exception e) { break; } } return value; }