sim.toolkit
Class EditHandler

java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.EditHandler
Direct Known Subclasses:
EnvelopeResponseHandler, ProactiveHandler

public 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.

Version:
5.0.1
See Also:
ViewHandler, ProactiveHandler, EnvelopeResponseHandler, ToolkitException

Method Summary
 void appendArray(byte[] buffer, short offset, short length)
          Appends a buffer into the EditHandler buffer.
 void appendTLV(byte tag, byte value)
          Appends a TLV element to the current TLV list (1-byte element).
 void appendTLV(byte tag, byte[] value, short valueOffset, short valueLength)
          Appends a TLV element to the current TLV list (byte array format).
 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.
 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).
 void clear()
          Clears the TLV list of an EditHandler and resets the current TLV selected.
 
Methods inherited from class sim.toolkit.ViewHandler
compareValue, copy, copyValue, findAndCompareValue, findAndCompareValue, findAndCopyValue, findAndCopyValue, findTLV, getLength, getValueByte, getValueLength
 
Methods inherited from class java.lang.Object
equals
 

Method Detail

clear

public void clear()
           throws ToolkitException
Clears the TLV list of an EditHandler and resets the current TLV selected.
Throws:
ToolkitException - with the following reason codes:
  • HANDLER_NOT_AVAILABLE if the handler is busy

appendArray

public void appendArray(byte[] buffer,
                        short offset,
                        short length)
                 throws java.lang.NullPointerException,
                        java.lang.ArrayIndexOutOfBoundsException,
                        ToolkitException
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:

Parameters:
buffer - the buffer containing data for copy
offset - the offset in the buffer
length - the value length of the buffer
Throws:
java.lang.NullPointerException - if buffer is null
java.lang.ArrayIndexOutOfBoundsException - if append would cause access of data outside array bounds
ToolkitException - with the following reason codes:
  • HANDLER_OVERFLOW if the EditHandler buffer is to small to append the requested data
  • HANDLER_NOT_AVAILABLE if the handler is busy

appendTLV

public void appendTLV(byte tag,
                      byte[] value,
                      short valueOffset,
                      short valueLength)
               throws java.lang.NullPointerException,
                      java.lang.ArrayIndexOutOfBoundsException,
                      ToolkitException
Appends a TLV element to the current TLV list (byte array format). A successful append does not modify the TLV selected.

Notes:

Parameters:
tag - the tag of the TLV to append, including the Comprehension Required flag
value - the buffer containing the TLV value
valueOffset - the offset of the TLV value in the buffer
valueLength - the value length of the TLV to append
Throws:
java.lang.NullPointerException - if value is null
java.lang.ArrayIndexOutOfBoundsException - if append would cause access of data outside array bounds
ToolkitException - with the following reason codes:
  • HANDLER_OVERFLOW if the EditHandler buffer is to small to append the requested data
  • HANDLER_NOT_AVAILABLE if the handler is busy
  • BAD_INPUT_PARAMETER if valueLength is greater than 255

appendTLV

public void appendTLV(byte tag,
                      byte value)
               throws ToolkitException
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.
Parameters:
tag - the tag of the TLV to append, including the Comprehension Required flag
value - the TLV value on 1 byte
Throws:
ToolkitException - with the following reason codes:
  • HANDLER_OVERFLOW if the EditHandler buffer is to small to append the requested data
  • HANDLER_NOT_AVAILABLE if the handler is busy

appendTLV

public void appendTLV(byte tag,
                      byte value1,
                      byte value2)
               throws ToolkitException
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.
Parameters:
tag - the tag of the TLV to append, including the Comprehension Required flag
value1 - the 1st byte (msb) of the TLV value
value2 - the 2nd byte (lsb) of the TLV value
Throws:
ToolkitException - with the following reason codes:
  • HANDLER_OVERFLOW if the EditHandler buffer is to small to append the requested data
  • HANDLER_NOT_AVAILABLE if the handler is busy

appendTLV

public void appendTLV(byte tag,
                      byte value1,
                      byte[] value2,
                      short value2Offset,
                      short value2Length)
               throws java.lang.NullPointerException,
                      java.lang.ArrayIndexOutOfBoundsException,
                      ToolkitException
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:

Parameters:
tag - the tag of the TLV to append, including the Comprehension Required flag
value1 - the first byte in the value field
value2 - the buffer containing the rest of the TLV field
value2Offset - the offset of the rest of the TLV field in the buffer
value2Length - the value length of the rest of the TLV field to append
Throws:
java.lang.NullPointerException - if value2 is null
java.lang.ArrayIndexOutOfBoundsException - if append would cause access of data outside array bounds.
ToolkitException - with the following reason codes:
  • HANDLER_OVERFLOW if the EditHandler buffer is to small to append the requested data
  • HANDLER_NOT_AVAILABLE if the handler is busy
  • BAD_INPUT_PARAMETER if value2Length is greater than 254