Package de.cardcontact.tlv
Class ObjectIdentifier
- java.lang.Object
-
- de.cardcontact.tlv.TLV
-
- de.cardcontact.tlv.PrimitiveTLV
-
- de.cardcontact.tlv.ObjectIdentifier
-
- All Implemented Interfaces:
TreeNode
public class ObjectIdentifier extends PrimitiveTLV
Class to implement TLV encoded Object Identifier according to ASN.1- Author:
- Andreas Schwier (info@cardcontact.de)
-
-
Field Summary
-
Fields inherited from class de.cardcontact.tlv.PrimitiveTLV
value
-
Fields inherited from class de.cardcontact.tlv.TLV
alternateLengthFormat, name, tag
-
-
Constructor Summary
Constructors Constructor Description ObjectIdentifier(byte[] value)
Create object identifier from binary presentationObjectIdentifier(int[] oid)
Create object identifierObjectIdentifier(int[] baseoid, int[] extoid)
Create object identifier from base and extensionObjectIdentifier(ParseBuffer pb)
Create object identifier from binary presentationObjectIdentifier(TLV tlv)
Copy constructor to convert PrimitiveTLV to typed object Make sure, that the parent is updated with the new referenceObjectIdentifier(java.lang.String oid)
Create object identifier from string
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int[]
convertBytesToOID(byte[] value)
Helper to convert binary data into list of object identifier componentsjava.lang.String
dump(int indent)
Convert object identifier to ASN.1 string syntaxprotected void
fromIntArray(int[] oid)
Helper to create value field from array of object identifier elementsprotected void
fromString(java.lang.String oid)
Helper to create byte array from stringstatic ObjectIdentifier
getInstance(TLV tlv)
Convert - if needed - the PrimitiveTLV to a ObjectIdentifierstatic ObjectIdentifier
getInstance(TLV tlv, Tag et)
Check tag and convert - if needed - the PrimitiveTLV to a ObjectIdentifierint[]
getObjectIdentifier()
Return object identifierstatic java.lang.String
getObjectIdentifierAsString(int[] oid)
Convert list of object identifier into dotted string formatjava.lang.String
toString()
Return object identifier as ASN.1 string-
Methods inherited from class de.cardcontact.tlv.PrimitiveTLV
equals, getChildAt, getChildCount, getDate, getIndex, getLength, getParent, getValue, hashCode, isLeaf, toByteArray, valueToByteArray
-
Methods inherited from class de.cardcontact.tlv.TLV
dump, dumpSingleLine, factory, factory, factory, getBytes, getLengthFieldAsByteArray, getLengthFieldSize, getLengthFieldSizeHelper, getName, getSize, getTag, lengthFromByteArray, lengthToByteArray, setName, setTag, useAlternateLengthEncoding
-
-
-
-
Constructor Detail
-
ObjectIdentifier
public ObjectIdentifier(int[] oid)
Create object identifier- Parameters:
oid
- Integer array with identifier
-
ObjectIdentifier
public ObjectIdentifier(ParseBuffer pb) throws TLVEncodingException
Create object identifier from binary presentation- Parameters:
pb
- Buffer with binary presentation- Throws:
TLVEncodingException
-
ObjectIdentifier
public ObjectIdentifier(byte[] value)
Create object identifier from binary presentation- Parameters:
pb
- Buffer with binary presentation
-
ObjectIdentifier
public ObjectIdentifier(java.lang.String oid)
Create object identifier from string- Parameters:
oid
- Dottet or blank separated object identifier
-
ObjectIdentifier
public ObjectIdentifier(int[] baseoid, int[] extoid)
Create object identifier from base and extension- Parameters:
baseoid
- Base object identifierextoid
- Extension added to base object identifier
-
ObjectIdentifier
public ObjectIdentifier(TLV tlv) throws TLVEncodingException
Copy constructor to convert PrimitiveTLV to typed object Make sure, that the parent is updated with the new reference- Parameters:
tlv
- the PrimitiveTLV object- Throws:
TLVEncodingException
-
-
Method Detail
-
getInstance
public static ObjectIdentifier getInstance(TLV tlv, Tag et) throws TLVEncodingException
Check tag and convert - if needed - the PrimitiveTLV to a ObjectIdentifier- Parameters:
tlv
-et
- et tag used in implicit encoding- Throws:
TLVEncodingException
-
getInstance
public static ObjectIdentifier getInstance(TLV tlv) throws TLVEncodingException
Convert - if needed - the PrimitiveTLV to a ObjectIdentifier- Parameters:
tlv
-- Returns:
- Throws:
TLVEncodingException
-
fromIntArray
protected void fromIntArray(int[] oid)
Helper to create value field from array of object identifier elements- Parameters:
oid
- Array containing object identifier elements
-
fromString
protected void fromString(java.lang.String oid)
Helper to create byte array from string- Parameters:
oid
-
-
getObjectIdentifier
public int[] getObjectIdentifier()
Return object identifier- Returns:
- Object identifier as int[]
-
convertBytesToOID
public static int[] convertBytesToOID(byte[] value)
Helper to convert binary data into list of object identifier components- Parameters:
value
- Binary data- Returns:
- Array of object identifiers
-
getObjectIdentifierAsString
public static java.lang.String getObjectIdentifierAsString(int[] oid)
Convert list of object identifier into dotted string format- Parameters:
oid
- Array of object identifier- Returns:
- String in dotted format
-
dump
public java.lang.String dump(int indent)
Convert object identifier to ASN.1 string syntax- Overrides:
dump
in classPrimitiveTLV
- Parameters:
indent
- Left indentation- Returns:
- String containing the ASN.1 representation
-
toString
public java.lang.String toString()
Return object identifier as ASN.1 string- Overrides:
toString
in classPrimitiveTLV
- Returns:
- String in ASN.1 notation
-
-