由于对于ASCII的编码解码有缺陷,且这种BCD实现并不规范,因此BCD标记为弃用

This commit is contained in:
Looly
2022-10-24 19:45:11 +08:00
parent c54b529153
commit 2142d6522a
5 changed files with 16 additions and 3 deletions

View File

@@ -8,7 +8,9 @@ import cn.hutool.core.lang.Assert;
* see http://cuisuqiang.iteye.com/blog/1429956
* @author Looly
*
* @deprecated 由于对于ASCII的编码解码有缺陷且这种BCD实现并不规范因此会在6.0.0中移除
*/
@Deprecated
public class BCD {
/**

View File

@@ -7,11 +7,11 @@ public class BCDTest {
@Test
public void bcdTest(){
String strForTest = "123456ABCDEF";
final String strForTest = "123456ABCDEF";
//转BCD
byte[] bcd = BCD.strToBcd(strForTest);
String str = BCD.bcdToStr(bcd);
final byte[] bcd = BCD.strToBcd(strForTest);
final String str = BCD.bcdToStr(bcd);
//解码BCD
Assert.assertEquals(strForTest, str);
}