solve meaven error & writing encoder ...

This commit is contained in:
free will committed 2021-03-05 22:04:19 +08:00
1 parent 4877609b75
commit faf17d314c
7 files changed
+205 -14

No files matched your search

+20 -5
View File
@@ -1,4 +1,4 @@
package main.java.encoding;
package encoding;
import java.math.BigInteger;
@@ -7,6 +7,7 @@ import static java.lang.Math.pow;
/*
* @Author: Wang Feng
* @Description:变长无符号整型,用于表示TLV中的T和L
* todo: 本类需要在VlInt经过彻底测试之后,再进行完善。或可直接继承vlint
* @Version: 1.0.0
* @Date: 18:13 2021/3/1
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
@@ -68,22 +69,27 @@ public class SizeT {
this.VlIntBytes=bigInteger2vlintBytes(this.VlIntValue);
}
public SizeT(long l){
this.VlIntValue=BigInteger.valueOf(l);
this.VlIntBytes=bigInteger2vlintBytes(this.VlIntValue);
}
// todo:传入一个long,将它解析成一个VlInt
// 将vlint转为一个int输出:需要判断size是不是小于4(1 or 3)
public Integer getVlIntValue2Int(){
public int getVlIntValue2Int(){
if(this.SizeOfVarNumber()<4){
return VlIntValue.intValue();
}
return null;
return Integer.parseInt(null);
}
// 将vlint转为一个long输出:需要判断size是不是小于8(5)
public Long getVlIntValue2Long(){
public long getVlIntValue2Long(){
if(this.SizeOfVarNumber()<8){
return VlIntValue.longValue();
}
return null;
return Long.parseLong(null);
}
// 将vlint转为一个biginteger输出:需要判断size是不是等于9(9)
@@ -113,6 +119,15 @@ public class SizeT {
// todo: 判断vlint是否与某个long值相等
/**
* 增加VlInt
* @param vlInt
* @return
*/
public int add(SizeT vlInt){
return this.VlIntValue.add(vlInt.VlIntValue).intValue();
}
/**
* 判断与另一个VlInt的数值孰大孰小
* @param vlInt