Class ConstructedTLV

    • Field Detail

      • childs

        protected java.util.ArrayList<TLV> childs
    • Constructor Detail

      • ConstructedTLV

        public ConstructedTLV​(Tag newtag)
        Create empty constructed tlv object with given Tag object
        Parameters:
        newtag - Tag for constructed TLV object
      • ConstructedTLV

        public ConstructedTLV​(int tagValue)
                       throws TLVEncodingException
        Create empty constructed tlv object and given Tag value
        Parameters:
        tagValue - Tag value for constructed TLV object
        Throws:
        TLVEncodingException
      • ConstructedTLV

        public ConstructedTLV​(byte[] buffer)
                       throws TLVEncodingException
        Create constructed TLV object from byte array
        Parameters:
        buffer - Byte array containing data object
        Throws:
        TLVEncodingException
      • ConstructedTLV

        public ConstructedTLV​(TLV tlv)
                       throws java.lang.UnsupportedOperationException
        Copy constructor Initialize with existing ConstructedTLV object. Does not perform a deep copy. The tag and list of contained objects are reassigned. Caution: If applied to a TLV object embedded in a complex structure remember to update the reference to this object in the parent node.
        Parameters:
        tlv - ConstructedTLV
        Throws:
        java.lang.UnsupportedOperationException
    • Method Detail

      • valueToByteArray

        protected int valueToByteArray​(byte[] buffer,
                                       int offset)
        Store value from constructed object to binary buffer
        Specified by:
        valueToByteArray in class TLV
        Parameters:
        buffer - Byte array that received the binary data
        offset - Offset in byte array
        Returns:
        New offset behind the stored object
      • toByteArray

        protected int toByteArray​(byte[] buffer,
                                  int offset)
        Store constructed object to binary buffer
        Specified by:
        toByteArray in class TLV
        Parameters:
        buffer - Byte array that received the binary data
        offset - Offset in byte array
        Returns:
        New offset behind the stored object
      • getLength

        public int getLength()
        Determine length of value field
        Specified by:
        getLength in class TLV
        Returns:
        Length in bytes
      • add

        public ConstructedTLV add​(TLV tlv)
        Add tlv object to constructed TLV
        Parameters:
        tlv - TLV object to be added
      • add

        public ConstructedTLV add​(int index,
                                  TLV tlv)
        Add tlv object to constructed TLV at index
        Parameters:
        index - the zero based index for insertion
        tlv - the TLV object to be added
      • remove

        public void remove​(int index)
        >Remove tlv element at index
        Parameters:
        index - the index of the element to be removed
      • get

        public TLV get​(int index)
        Return tlv object at index
        Parameters:
        index -
        Returns:
        tlv object
      • getElements

        public int getElements()
        Return number of child elements
        Returns:
        number of child elements
      • findTag

        public TLV findTag​(Tag tag,
                           TLV cursor)
        Find matching tag in constructed TLV
        Parameters:
        tag - Tag to search
        cursor - null to start at the beginning or result of last search to continue
        Returns:
        null if tag not found or TLV object
      • dump

        public java.lang.String dump​(int indent)
        Return dump of constructed TLV object using a given left indentation
        Specified by:
        dump in class TLV
        Parameters:
        indent - Left indentation to be used
        Returns:
        String containing dump of primitive TLV object
      • getChildCount

        public int getChildCount()
        Return number of childs, of object is constructed
        Returns:
        Number of childs
        See Also:
        TreeNode.getChildCount()
      • isLeaf

        public boolean isLeaf()
        Return true
        Returns:
        Node is leaf node
        See Also:
        TreeNode.isLeaf()
      • getParent

        public TreeNode getParent()
        Get parent if it is known
        Returns:
        Parent or null if root or unknown
        See Also:
        TreeNode.getParent()