EditHandlerpublic abstract class EditHandler extends ViewHandler This class is the basic class for the construction of a list of simple TLV
elements.
This class is able to handle Simple TLV with a value field no longer than
255 bytes. |
Constructors Summary |
---|
EditHandler()Default constructor.
| EditHandler(byte[] buffer, short offset, short length)Builds a new EditHandler object.
|
Methods Summary |
---|
public void | appendArray(byte[] buffer, short offset, short length)Appends a buffer into the EditHandler buffer.
A successful append does not modify the TLV selected.
The TLV list structure of the handler should be maintained by the
applet in the appended array (e.g. the length of the TLV element
should be coded according to ISO 7816-6), if the TLV manipulation
methods are to be used afterwards with the handler.
Notes:
- If
offset or
length parameter is negative an
ArrayIndexOutOfBoundsException
exception is thrown and no append is performed.
- If
offset+length is greater than
buffer.length , the length of the
buffer array an
ArrayIndexOutOfBoundsException exception is
thrown and no append is performed.
byte[] APDUBuffer = ViewHandler.getAPDUBuffer();
Util.arrayCopy(buffer, offset, APDUBuffer, (short)0, length);
ViewHandler.setOutBufferData(length);
| public void | appendTLV(byte tag, byte[] value, short valueOffset, short valueLength)Appends a TLV element to the current TLV list (byte array format).
A successful append does not modify the TLV selected.
Notes:
- If
valueOffset or
valueLength parameter is negative an
ArrayIndexOutOfBoundsException
exception is thrown and no append is performed.
- If
valueOffset+valueLength is
greater than value.length , the length
of the value array an
ArrayIndexOutOfBoundsException exception
is thrown and no append is performed.
byte[] APDUBuffer = ViewHandler.getAPDUBuffer();
// prepare the data to be appended to the TLV list
APDUBuffer[0] = tag;
APDUBuffer[1] = (byte)valueLength;
Util.arrayCopy(value, valueOffset, APDUBuffer, (short)2, valueLength);
ViewHandler.setOutBufferData((short)(valueLength + 2));
| public void | appendTLV(byte tag, byte value)Appends a TLV element to the current TLV list (1-byte element).
This method is useful to add single byte elements as Item Identifier
or Tone.
A successful append does not modify the TLV selected.
byte[] APDUBuffer = ViewHandler.getAPDUBuffer();
// prepare the data to be appended to the TLV list
APDUBuffer[0] = tag; // set the tag
APDUBuffer[1] = (byte)1; // 1-byte element so length is 1
APDUBuffer[2] = value; // 1-byte element
ViewHandler.setOutBufferData((short)3);
| public void | appendTLV(byte tag, byte value1, byte value2)Appends a TLV element to the current TLV list (2-byte element)
This method is useful to add double byte elements as Device Identities,
Duration or Response Length. A successful append does not modify the
TLV selected.
byte[] APDUBuffer = ViewHandler.getAPDUBuffer();
// prepare the data to be appended to the TLV list
APDUBuffer[0] = tag; // set the tag
APDUBuffer[1] = (byte)1; // 2-byte element so length is 1
APDUBuffer[2] = value1; // 1-byte element
APDUBuffer[3] = value2; // 1-byte element
ViewHandler.setOutBufferData((short)4);
| public void | appendTLV(byte tag, byte value1, byte[] value2, short value2Offset, short value2Length)Appends a TLV element to the current TLV list (1 byte and a
byte array format).
A successful append does not modify the TLV selected.
Notes:
- If
value2Offset or
value2Length parameter is negative
an ArrayIndexOutOfBoundsException
exception is thrown and no append is performed.
- If
value2Offset+value2Length is greater
than value2.length , the length
of the value2 array an
ArrayIndexOutOfBoundsException exception is thrown
and no append is performed.
byte[] APDUBuffer = ViewHandler.getAPDUBuffer();
// prepare the data to be appended to the TLV list
APDUBuffer[0] = tag; // set the tag
APDUBuffer[1] = (byte)(value2Length + 1); // 1-byte element
// so length is 1
APDUBuffer[2] = value1; // 1-byte element
Util.arrayCopy(value2, value2Offset, APDUBuffer,
(short)3, value2Length);
ViewHandler.setOutBufferData((short)(value2Length+3));
| public void | clear()Clears the TLV list of an EditHandler and resets the current
TLV selected.
|
|