mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
finished component: IdentifierComponent
This commit is contained in:
1 parent
37cb1a9b36
commit
8182946c49
21 files changed
+279
-37
No files matched your search
@@ -20,6 +20,10 @@ public class Block {
|
||||
private ElementContainer elements; // TLV-sub-elements
|
||||
private byte[] raw; // TLV编码后的字节数组
|
||||
|
||||
public Block(){
|
||||
this.tlvType=new VlInt(TLV.TlvInvalid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从一个包含TLV的字节数组中构造一个 Block 对象
|
||||
* @param buffer
|
||||
@@ -27,7 +31,7 @@ public class Block {
|
||||
* 则会对比解析到的 TLV-LENGTH 与 TLV-VALUE的实际长度是否匹配
|
||||
* @return
|
||||
*/
|
||||
public Block createBlockByBuffer(byte[] buffer,boolean verifyLength){
|
||||
public static Block createBlockByBuffer(byte[] buffer,boolean verifyLength){
|
||||
if(buffer.length==0){
|
||||
return null;
|
||||
}
|
||||
@@ -57,7 +61,7 @@ public class Block {
|
||||
* @param verifyLength
|
||||
* @return
|
||||
*/
|
||||
public Block createBlockByTypeLengthBuffer(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength){
|
||||
public static Block createBlockByTypeLengthBuffer(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength){
|
||||
return new Block(tlvType,tlvLength,buffer,verifyLength);
|
||||
}
|
||||
|
||||
@@ -103,14 +107,18 @@ public class Block {
|
||||
}
|
||||
|
||||
public Block(Block block){
|
||||
|
||||
this.tlvType=block.tlvType;
|
||||
this.length=block.length;
|
||||
this.value=block.value;
|
||||
this.elements=block.elements;
|
||||
this.raw=block.raw;
|
||||
}
|
||||
|
||||
public VlInt getTlvType() {
|
||||
public VlInt getType() {
|
||||
return tlvType;
|
||||
}
|
||||
|
||||
public void setTlvType(VlInt tlvType) {
|
||||
public void setType(VlInt tlvType) {
|
||||
this.tlvType = tlvType;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user