mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
refresh test: ttl,etc...
This commit is contained in:
1 parent
dc060c2fc2
commit
fafde2b015
14 files changed
+307
-347
No files matched your search
@@ -44,37 +44,32 @@ public class CanBePrefix implements TlvComponentBase,InitialAble, IEncodingAble
|
||||
*/
|
||||
@Override
|
||||
public int wireEncode(Encoder encoder) throws ComponentException {
|
||||
// 这是一个存在性组件,所以如果值为false,则无需编码
|
||||
if(!this.canBePrefix){
|
||||
return -1;
|
||||
}
|
||||
|
||||
int totalLength=0;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
int tmplen= 0;
|
||||
try {
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
// 这是一个存在性组件,所以如果值为false,则无需编码
|
||||
if (!this.canBePrefix) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int totalLength = 0;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
int tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen <= 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvCanBePrefix));
|
||||
if (tmplen <= 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
return totalLength;
|
||||
} catch (EncoderException e) {
|
||||
throw new ComponentException("CanBePrefix.wireEncode: "+e.getMessage());
|
||||
}
|
||||
if(tmplen<=0){
|
||||
return -1;
|
||||
}
|
||||
totalLength+=tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
try {
|
||||
tmplen=encoder.prependVarNumber(new VlInt(TLV.TlvCanBePrefix));
|
||||
} catch (EncoderException e) {
|
||||
throw new ComponentException("CanBePrefix.wireEncode: "+e.getMessage());
|
||||
}
|
||||
if(tmplen<=0){
|
||||
return -1;
|
||||
}
|
||||
totalLength+=tmplen;
|
||||
|
||||
return totalLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,6 +86,7 @@ public class CanBePrefix implements TlvComponentBase,InitialAble, IEncodingAble
|
||||
|
||||
// 这是一个存在性组件,所以存在则为 true
|
||||
this.canBePrefix=true;
|
||||
this.doInitial();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user