本文整理汇总了Java中org.apache.commons.codec.StringEncoder类的典型用法代码示例。如果您正苦于以下问题:Java StringEncoder类的具体用法?Java StringEncoder怎么用?Java StringEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringEncoder类属于org.apache.commons.codec包,在下文中一共展示了StringEncoder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAsStringEncoder
import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
@Test
public void testAsStringEncoder() throws EncoderException {
final StringEncoder encoder =
(StringEncoder) RareStringEncoderProxy.newInstance();
try {
encoder.encode((String) null);
Assert.fail("passed: encode((String) null)");
} catch (final NullPointerException npe) {
// expected
}
final String expected = "";
final String actual = encoder.encode(expected);
Assert.assertEquals(actual, expected);
}
示例2: difference
import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
static int difference(StringEncoder encoder, String s1, String s2) throws EncoderException {
return differenceEncoded(encoder.encode(s1), encoder.encode(s2));
}
示例3: difference
import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
static int difference(StringEncoder encoder, String s1, String s2)
/* 29: */ throws EncoderException
/* 30: */ {
/* 31: 85 */ return differenceEncoded(encoder.encode(s1), encoder.encode(s2));
/* 32: */ }
示例4: difference
import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
static int difference(StringEncoder paramStringEncoder, String paramString1, String paramString2)
throws EncoderException
{
return differenceEncoded(paramStringEncoder.encode(paramString1), paramStringEncoder.encode(paramString2));
}
示例5: createStringEncoder
import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
@Override
protected StringEncoder createStringEncoder() {
return new BeiderMorseEncoder();
}
示例6: EncoderTokenFilter
import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
public EncoderTokenFilter(TokenStream input, StringEncoder encoder) {
super(input);
this.encoder = encoder;
}
示例7: difference
import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
/**
* Encodes the Strings and returns the number of characters in the two
* encoded Strings that are the same.
* <ul>
* <li>For Soundex, this return value ranges from 0 through 4: 0 indicates
* little or no similarity, and 4 indicates strong similarity or identical
* values.</li>
* <li>For refined Soundex, the return value can be greater than 4.</li>
* </ul>
*
* @param encoder
* The encoder to use to encode the Strings.
* @param s1
* A String that will be encoded and compared.
* @param s2
* A String that will be encoded and compared.
* @return The number of characters in the two Soundex encoded Strings that
* are the same.
*
* @see #differenceEncoded(String,String)
* @see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_de-dz_8co5.asp">
* MS T-SQL DIFFERENCE</a>
*
* @throws EncoderException
* if an error occurs encoding one of the strings
*/
static int difference(final StringEncoder encoder, final String s1, final String s2) throws EncoderException {
return differenceEncoded(encoder.encode(s1), encoder.encode(s2));
}