Class PrimitiveTLV

    • Field Detail

      • value

        protected byte[] value
    • Constructor Detail

      • PrimitiveTLV

        public PrimitiveTLV​(Tag newtag,
                            byte[] newvalue)
        Create a primitive TLV object with tag and value
        Parameters:
        newtag - Tag as object
        newvalue - Byte array containing value
      • PrimitiveTLV

        public PrimitiveTLV​(int newTagValue,
                            byte[] newvalue)
                     throws TLVEncodingException
        Create a primitive TLV object with tag given as integer value
        Parameters:
        newTagValue - Tag as integer value
        newvalue - Byte array containing value
        Throws:
        TLVEncodingException
      • PrimitiveTLV

        public PrimitiveTLV​(byte[] buffer,
                            int offset)
                     throws TLVEncodingException
        Create a primitive TLV object from binary data in buffer at given offset
        Parameters:
        buffer - Buffer containing TLV object
        offset - Offset in buffer
        Throws:
        TLVEncodingException
      • PrimitiveTLV

        public PrimitiveTLV​(byte[] buffer)
                     throws TLVEncodingException
        Create a primitive TLV object or structure from binary
        Parameters:
        buffer - Binary data containing TLV structure
        Throws:
        TLVEncodingException
      • PrimitiveTLV

        public PrimitiveTLV​(TLV tlv)
                     throws TLVEncodingException
        Copy constructor Initialize with existing PrimitiveTLV object. Does not perform a deep copy. The tag and value 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 - PrimitiveTLV
        Throws:
        java.lang.UnsupportedOperationException
        TLVEncodingException
    • Method Detail

      • valueToByteArray

        protected int valueToByteArray​(byte[] buffer,
                                       int offset)
        Store value in 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 primitive 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()
        Return length of value field
        Specified by:
        getLength in class TLV
        Returns:
        Length in bytes
      • getValue

        public byte[] getValue()
        Return the value
        Overrides:
        getValue in class TLV
        Returns:
        Byte array containing the value
      • getDate

        public java.util.Date getDate()
                               throws java.io.UnsupportedEncodingException
        Return value as date
        Returns:
        Date
        Throws:
        java.io.UnsupportedEncodingException
      • equals

        public boolean equals​(java.lang.Object testtlv)
        Test for equality
        Overrides:
        equals in class java.lang.Object
        Parameters:
        testtlv - Object to test for
        Returns:
        True if values are equal
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • dump

        public java.lang.String dump​(int indent)
        Return dump of primitive 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
      • toString

        public java.lang.String toString()
        Return Tag of TLV object as string
        Overrides:
        toString in class TLV
        Returns:
        String containing name of 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()
        Return parent - This we don't know
        Returns:
        Parent or null if root or unknown
        See Also:
        TreeNode.getParent()
      • getChildAt

        public TreeNode getChildAt​(int index)
        Return child at index - No childs for PrimitiveTLV
        Returns:
        Child node
        See Also:
        TreeNode.getChildAt(int)