Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions jpos/src/main/java/org/jpos/iso/DatasetElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ public boolean isConstructed() {
return constructed;
}

/**
* Indicates whether a BER-TLV tag is constructed, that is, whether bit 6
* of its first byte is set.
*
* @param tag TLV tag, for example {@code 0x71} or {@code 0x9F26}
* @return {@code true} for constructed tags
*/
public static boolean isConstructedTag(int tag) {
String hexTag = Integer.toHexString(tag);
if ((hexTag.length() & 0x01) == 1)
hexTag = "0" + hexTag;
byte[] tagBytes = ISOUtil.hex2byte(hexTag);
return (tagBytes[0] & 0x20) == 0x20;
}

/**
* Returns the component value.
*
Expand Down
Loading
Loading