error handle to all: EncoderException

This commit is contained in:
free will committed 2021-03-18 11:22:49 +08:00
1 parent 5fc080ca6c
commit 8cf6ed24c9
34 files changed
+700 -233

No files matched your search

+7 -7
View File
@@ -63,27 +63,27 @@ public class Payload implements TlvComponentBase,InitialAble, IEncodingAble {
* @return
*/
@Override
public int wireEncode(Encoder encoder) {
public int wireEncode(Encoder encoder) throws EncoderException {
int totalLength=0;
// 编码 TLV-VALUE
int tmplen=encoder.prependByteArray(this.value,new SizeT(this.value.length));
if(tmplen==0){
return 0;
if(tmplen<=0){
return -1;
}
totalLength+=tmplen;
// 编码 TLV-LENGTH
tmplen+=encoder.prependVarNumber(new VlInt(totalLength));
if(tmplen==0){
return 0;
if(tmplen<=0){
return -1;
}
totalLength+=tmplen;
// 编码 TLV-TYPE
tmplen+=encoder.prependVarNumber(new VlInt(TLV.TlvPayload));
if(tmplen==0){
return 0;
if(tmplen<=0){
return -1;
}
totalLength+=tmplen;