|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--opencard.opt.util.Tag
This class represents Tags as defined in the Basic Encoding Rules for ASN.1 defined in ISO 8825. A tag consists of two class bits (0 - 4), a flag indicating wether the TLV is constructed or primitive.
The encoding is like this (C = class bit, c = composed flag, X = data bit):
Range from 0x0 - 0x1E: C C c X X X X X
Range from 0x1F - 0x80: C C c 1 1 1 1 1 0 X X X X X X X
Range from 0x81 - 0x4000: C C c 1 X X X X 1 X X X X X X X 0 X X X X X X X
Range from 0x4001 - 0x200000: C C c 1 X X X X 1 X X X X X X X 1 X X X X X X X 0 X X X X X X X
Range from 0x200001 - 0x10000000: C C c 1 X X X X 1 X X X X X X X 1 X X X X X X X 0 X X X X X X X 0 X X X X X X X
TLV
Constructor Summary | |
Tag()
Create a null tag. |
|
Tag(byte[] binary)
|
|
Tag(byte[] binary,
int[] offset)
Create a tag from binary representation. |
|
Tag(int tag,
byte tagClass,
boolean constructed)
Creates a tag from a given tag value, class and constructed flag. |
|
Tag(Tag t)
Clone a tag. |
Method Summary | |
int |
code()
Get the code of the tag. |
boolean |
equals(java.lang.Object o)
Check for equality. |
void |
fromBinary(byte[] binary,
int[] offset)
Initialize the Tag object from a BER-coded binary representation. |
byte[] |
getBytes()
Gets a byte array representing the tag. |
int |
hashCode()
Compute a hash code for this tag. |
boolean |
isConstructed()
Check whether this Tag is constructed. |
void |
set(int tag,
byte tagclass,
boolean constructed)
Set the tag number, class and constructed flag of this Tag to the given values. |
void |
setConstructed(boolean constructed)
Set the constructed flag of this Tag to the given value. |
int |
size()
Return the number of bytes which are required to BER-code the tag value. |
void |
toBinary(byte[] binary,
int[] offset)
Convert the tag to binary representation. |
java.lang.String |
toString()
Get a string representation for this tag. |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Tag()
public Tag(Tag t)
t
- The Tag object to be cloned.public Tag(int tag, byte tagClass, boolean constructed)
tag
- An integer representing the value of the tag.tagClass
- A byte value representing the class of the tag.constructed
- A boolean value true signals that the tag is
constructed, false signals that the tag is
primitive.public Tag(byte[] binary, int[] offset)
binary
- The byte array from which the tag shall be generated.offset
- An integer value giving the offset into the the byte array
from where to start.public Tag(byte[] binary)
Method Detail |
public int size()
public void fromBinary(byte[] binary, int[] offset)
binary
- A byte array containing the BER-coded tag.offset
- An integer giving an offset into the byte array
from where to start.public byte[] getBytes()
public void toBinary(byte[] binary, int[] offset)
binary
- A byte array to which the BER-coded binary representation
of the tag shall be written.offset
- An integer value giving an offset into the byte array from
where to start.public void set(int tag, byte tagclass, boolean constructed)
tag
- An integer value giving the tag value.tagclass
- A byte value giving the class.constructed
- A boolean representing the constructed flag.public void setConstructed(boolean constructed)
constructed
- A boolean representing the constructed flag.public int code()
public boolean isConstructed()
public int hashCode()
public boolean equals(java.lang.Object o)
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |