/**
* Tests that <code>skipFully</code> throws exception if there is a UTF-8
* encoding error in the stream
*
* @throws IOException if the test fails for some unexpected reason
*/
public void testSkipFullyOnInvalidStreamCJK()
throws IOException {
final int charLength = 10;
InputStream in = new ReaderToUTF8Stream(
new LoopingAlphabetReader(charLength, CharAlphabet.cjkSubset()),
charLength, 0, "ignored-test-type");
in.skip(2L); // Skip encoded length added by ReaderToUTF8Stream.
in.skip(1L); // Skip one more byte to trigger a UTF error.
try {
UTF8Util.skipFully(in, charLength);
fail("Should have failed because of UTF error.");
} catch (UTFDataFormatException udfe) {
// As expected, do nothing.
}
}
UTF8UtilTest.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:gemfirexd-oss
作者:
评论列表
文章目录