intarsys runtime library

de.intarsys.tools.tlv.common
Class TlvElement

java.lang.Object
  extended by de.intarsys.tools.tlv.common.TlvElement
Direct Known Subclasses:
SimpleElement

public abstract class TlvElement
extends Object

A TLV element is a "tag, length, value" data structure. First, an identifier is expected, followed by a length, followed by the data itself.

This abstract implementation does not imply anything about the encoding of the identifier, length or value field. This is deferred to a concrete implementation, e.g. a ASN.1 DER implementation.

The TLV element is parsed from an associated TlvInputStream.


Method Summary
abstract  TlvInputStream createTlvInputStream(byte[] pBytes, int pOffset, int pLength)
           
 byte[] getContent()
          The data part within the TLV element.
abstract  byte[] getEncoded()
          The whole, encoded TLV element.
 int getIdentifier()
          The identifier for this TLV element.
 int getLength()
          The length of the TLV elements data
 TlvTemplate getTemplate()
          A composite TlvElement contains other TlvElement instances in form of a TlvTemplate.
abstract  boolean isComposite()
          true if this element contains TLV data itself.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createTlvInputStream

public abstract TlvInputStream createTlvInputStream(byte[] pBytes,
                                                    int pOffset,
                                                    int pLength)

getContent

public byte[] getContent()
The data part within the TLV element.

Returns:
The data part within the TLV element.

getEncoded

public abstract byte[] getEncoded()
The whole, encoded TLV element.

Returns:
The whole, encoded TLV element.

getIdentifier

public int getIdentifier()
The identifier for this TLV element.

An identifier may be made up of different components, see ASN.1.

Returns:
The identifier for this TLV element.

getLength

public int getLength()
The length of the TLV elements data

Returns:
The length of the TLV elements data

getTemplate

public TlvTemplate getTemplate()
                        throws TlvFormatException
A composite TlvElement contains other TlvElement instances in form of a TlvTemplate.

Returns:
The contained TlvTemplate if available.
Throws:
TlvFormatException

isComposite

public abstract boolean isComposite()
true if this element contains TLV data itself.

Returns:
true if this element contains TLV data itself.

toString

public String toString()
Overrides:
toString in class Object

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.