| java.lang.Object sim.toolkit.ViewHandler
All known Subclasses: sim.toolkit.EditHandler, sim.toolkit.ProactiveResponseHandler, sim.toolkit.EnvelopeHandler,
ViewHandler | abstract public class ViewHandler (Code) | | The ViewHandler class offers basic services and contains basic
methods to handle
a Simple TLV List, such as in a Terminal Response data field
or in a BER-TLV
element (Envelope data field or Proactive command).
The byte at offset 0 of a handler is the tag of the first Simple TLV.
version: 8.3.0 See Also: ToolkitException |
Constructor Summary | |
| ViewHandler() Constructor. | | ViewHandler(byte[] buffer, short offset, short length) Builds a new ViewHandler object. |
Method Summary | |
public byte | compareValue(short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength) Compares the last found TLV element with a buffer. | public short | copy(byte[] dstBuffer, short dstOffset, short dstLength) Copies the simple TLV list contained in the handler to the
destination byte array. | public short | copyValue(short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength) Copies a part of the last TLV element which has been found, into a
destination buffer. | public byte | findAndCompareValue(byte tag, byte[] compareBuffer, short compareOffset) Looks for the first occurrence of a TLV element
from beginning of a TLV
list and compare its value with a buffer. | public byte | findAndCompareValue(byte tag, byte occurrence, short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength) Looks for the indicated occurrence of a TLV element from the
beginning of a TLV list and compare its value with a buffer.
If no TLV element is found, the UNAVAILABLE_ELEMENT
exception is thrown.
If the method is successful then the corresponding TLV becomes
current, else no TLV is selected.
This search method is Comprehension Required flag independent.
Notes:
- If
compareOffset or
compareLength parameter is
negative an ArrayIndexOutOfBoundsException
exception is thrown and no find and compare is performed.
- If
compareOffset+compareLength is
greater than compareBuffer.length , the length
of the compareBuffer array an
ArrayIndexOutOfBoundsException exception
is thrown and no find and compare is performed.
Parameters: tag - the tag of the TLV element to search Parameters: occurrence - the occurrence number of the TLV element (1 for the first, 2 for the second...) Parameters: valueOffset - the offset of the first byte in the source TLV element Parameters: compareBuffer - a reference to the comparison buffer Parameters: compareOffset - the position in the comparison buffer Parameters: compareLength - the length to be compared the result of the comparison as follows: 0 if identical-1 if the first miscomparing byte in simple TLV is less than that in compareBuffer ,1 if the first miscomparing byte in simple TLV is greater than that in compareBuffer .
exception: NullPointerException - if compareBuffer is null exception: ArrayIndexOutOfBoundsException - if findAndCompareValue would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV elementOUT_OF_TLV_BOUNDARIES if: valueOffset parameter is negative orvalueOffset + compareLength is greater than the length of the current TLV BAD_INPUT_PARAMETER if an input parameter is not valid (e.g.
| public short | findAndCopyValue(byte tag, byte[] dstBuffer, short dstOffset) Looks for the first occurrence of a TLV element from the beginning
of a TLV
list and copy its value into a destination buffer. | public short | findAndCopyValue(byte tag, byte occurrence, short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength) Looks for the indicated occurrence of a TLV element from the
beginning of a TLV
list and copy its value into a destination buffer.
If no TLV element is found, the UNAVAILABLE_ELEMENT
exception is thrown.
If the method is successful then the corresponding TLV becomes current,
else no TLV is selected.
This search method is Comprehension Required flag independent.
Notes:
- If
dstOffset or
dstLength parameter is negative
an ArrayIndexOutOfBoundsException
exception is thrown and no copy is performed.
- If
dstOffset+dstLength is greater
than dstBuffer.length , the length
of the dstBuffer array an
ArrayIndexOutOfBoundsException exception
is thrown and no copy is performed.
Parameters: tag - the tag of the TLV element to search Parameters: occurrence - the occurrence number of the TLV element (1 for the first, 2 for the second...) Parameters: valueOffset - the offset of the first byte in the source TLV element Parameters: dstBuffer - a reference to the destination buffer Parameters: dstOffset - the position in the destination buffer Parameters: dstLength - the data length to be copied dstOffset + dstLength exception: NullPointerException - if dstBuffer is null exception: ArrayIndexOutOfBoundsException - if findAndCopyValue would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV elementOUT_OF_TLV_BOUNDARIES if: valueOffset parameter is negative orvalueOffset + dstLength is greater than the length of the current TLV BAD_INPUT_PARAMETER if an input parameter is not valid (e.g.
| public byte | findTLV(byte tag, byte occurrence) Looks for the indicated occurrence of a TLV element from the beginning of
the TLV list (handler buffer). | public static byte[] | getAPDUBuffer(byte[] buffer) Copies the APDUBuffer content into provided buffer. | public static byte[] | getAPDUBuffer() Copies the APDUBuffer content into current buffer. | protected short | getLastTLVOffset(byte[] buffer, short Lc) Helper method for getValue... and
copyValue... . | public short | getLength() Returns the length of the TLV list. | protected short | getTLVOffset(byte[] buffer, byte tag, short Lc, short occurrence) Helper method for findAndCompareValue . | public byte | getValueByte(short valueOffset) Gets a byte from the last TLV element which has been found in the
handler. | public short | getValueLength() Gets the binary length of the value field for the last TLV element
which has been found in the handler. | public static void | setAPDUBuffer(byte[] buffer, short length) Copies content of provided buffer into the APDUBuffer. | public static void | setAPDUBuffer(short length) Copies content of current buffer into the APDUBuffer. | public static void | setOutBufferData(short length) Sets the data in the out buffer. |
BER_TLV_TAG_OFFSET | final protected static byte BER_TLV_TAG_OFFSET(Code) | | Offset of BER_TLV_TAG.
|
OFFSET_LC | final protected static byte OFFSET_LC(Code) | | Offset of Lc in the APDU buffer.
|
SATAccessor | public static AccessSAT SATAccessor(Code) | | Reference to SAT Accessor.
|
TPUD_OFFSET | final protected static byte TPUD_OFFSET(Code) | | Offset of TPDUD.
|
currentTLVOffset | short currentTLVOffset(Code) | | Offset of first occurrence of TLV.
|
firstTLVOffset | short firstTLVOffset(Code) | | Offset of first occurrence of TLV.
|
ViewHandler | ViewHandler()(Code) | | Constructor.
|
compareValue | public byte compareValue(short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Compares the last found TLV element with a buffer.
Notes:
- If
compareOffset or
compareLength parameter is negative
an ArrayIndexOutOfBoundsException
exception is thrown and no compare is performed.
- If
compareOffset+compareLength is
greater than compareBuffer.length , the length
of the compareBuffer array an
ArrayIndexOutOfBoundsException exception
is thrown and no compare is performed.
Parameters: valueOffset - the offset of the first byte to compare in the TLV element Parameters: compareBuffer - a reference to the comparison buffer Parameters: compareOffset - the position in the comparison buffer Parameters: compareLength - the length to be compared the result of the comparison as follows: 0 if identical-1 if the first miscomparing byte in simple TLV List is less than that in compareBuffer ,1 if the first miscomparing byte in simple TLV List is greater than that in compareBuffer .
exception: NullPointerException - if compareBuffer is null exception: ArrayIndexOutOfBoundsException - if compareValue would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV elementOUT_OF_TLV_BOUNDARIES if: valueOffset parameter is negative orvalueOffset + compareLength is greater than the length of the current TLV
|
copy | public short copy(byte[] dstBuffer, short dstOffset, short dstLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Copies the simple TLV list contained in the handler to the
destination byte array.
Notes:
- If
dstOffset or
dstLength parameter is negative
an ArrayIndexOutOfBoundsException
exception is thrown and no copy is performed.
- If
dstOffset+dstLength is greater
than dstBuffer.length , the length
of the dstBuffer array an
ArrayIndexOutOfBoundsException
exception is thrown and no copy is performed.
Parameters: dstBuffer - a reference to the destination buffer Parameters: dstOffset - the position in the destination buffer Parameters: dstLength - the data length to be copied dstOffset+dstLength exception: NullPointerException - if dstBuffer is null exception: ArrayIndexOutOfBoundsException - if copy would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyOUT_OF_TLV_BOUNDARIES if dstLength is grater than the length of the simple TLV List.
|
copyValue | public short copyValue(short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Copies a part of the last TLV element which has been found, into a
destination buffer.
Notes:
- If
dstOffset or
dstLength parameter is negative an
ArrayIndexOutOfBoundsException
exception is thrown and no copy is performed.
- If
dstOffset+dstLength is
greater than dstBuffer.length , the length
of the dstBuffer array an
ArrayIndexOutOfBoundsException exception
is thrown and no copy is performed.
Parameters: valueOffset - the offset of the first byte in the source TLV element Parameters: dstBuffer - a reference to the destination buffer Parameters: dstOffset - the position in the destination buffer Parameters: dstLength - the data length to be copied dstOffset+dstLength exception: NullPointerException - if dstBuffer is null exception: ArrayIndexOutOfBoundsException - if copyValue would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV elementOUT_OF_TLV_BOUNDARIES if: valueOffset parameter is negative orvalueOffset + dstLength is greater than the length of the current TLV
|
findAndCompareValue | public byte findAndCompareValue(byte tag, byte[] compareBuffer, short compareOffset) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Looks for the first occurrence of a TLV element
from beginning of a TLV
list and compare its value with a buffer.
If no TLV element is found, the
UNAVAILABLE_ELEMENT exception is thrown.
If the method is successful then the corresponding TLV
becomes current, else no TLV is selected.
This search method is Comprehension Required flag independent.
Notes:
- If
compareOffset parameter is
negative or compareOffset
is greater than compareBuffer.length ,
the length of the compareBuffer
array an ArrayIndexOutOfBoundsException
exception is thrown and no find is performed.
Parameters: tag - the tag of the TLV element to search Parameters: compareBuffer - a reference to the comparison buffer Parameters: compareOffset - the position in the comparison buffer the result of the comparison as follows: 0 if identical-1 if the first miscomparing byte in simple TLV is less than that in compareBuffer ,1 if the first miscomparing byte in simple TLV is greater than that in compareBuffer .
exception: NullPointerException - if compareBuffer is null exception: ArrayIndexOutOfBoundsException - if findAndCompareValue would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV element
|
findAndCompareValue | public byte findAndCompareValue(byte tag, byte occurrence, short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Looks for the indicated occurrence of a TLV element from the
beginning of a TLV list and compare its value with a buffer.
If no TLV element is found, the UNAVAILABLE_ELEMENT
exception is thrown.
If the method is successful then the corresponding TLV becomes
current, else no TLV is selected.
This search method is Comprehension Required flag independent.
Notes:
- If
compareOffset or
compareLength parameter is
negative an ArrayIndexOutOfBoundsException
exception is thrown and no find and compare is performed.
- If
compareOffset+compareLength is
greater than compareBuffer.length , the length
of the compareBuffer array an
ArrayIndexOutOfBoundsException exception
is thrown and no find and compare is performed.
Parameters: tag - the tag of the TLV element to search Parameters: occurrence - the occurrence number of the TLV element (1 for the first, 2 for the second...) Parameters: valueOffset - the offset of the first byte in the source TLV element Parameters: compareBuffer - a reference to the comparison buffer Parameters: compareOffset - the position in the comparison buffer Parameters: compareLength - the length to be compared the result of the comparison as follows: 0 if identical-1 if the first miscomparing byte in simple TLV is less than that in compareBuffer ,1 if the first miscomparing byte in simple TLV is greater than that in compareBuffer .
exception: NullPointerException - if compareBuffer is null exception: ArrayIndexOutOfBoundsException - if findAndCompareValue would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV elementOUT_OF_TLV_BOUNDARIES if: valueOffset parameter is negative orvalueOffset + compareLength is greater than the length of the current TLV BAD_INPUT_PARAMETER if an input parameter is not valid (e.g. occurrence = 0)
|
findAndCopyValue | public short findAndCopyValue(byte tag, byte[] dstBuffer, short dstOffset) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Looks for the first occurrence of a TLV element from the beginning
of a TLV
list and copy its value into a destination buffer.
If no TLV element is found, the UNAVAILABLE_ELEMENT
exception is thrown.
If the method is successful then the corresponding TLV becomes current,
else no TLV is selected.
This search method is Comprehension Required flag independent.
Notes:
- If
dstOffset parameter is negative or
dstOffset
is greater than dstBuffer.length , the
length of the dstBuffer
array an ArrayIndexOutOfBoundsException
exception is thrown and no find is performed.
Parameters: tag - the tag of the TLV element to search Parameters: dstBuffer - a reference to the destination buffer Parameters: dstOffset - the position in the destination buffer dstOffset + length of the copied value exception: NullPointerException - if dstBuffer is null exception: ArrayIndexOutOfBoundsException - if findAndCopyValue would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV element
|
findAndCopyValue | public short findAndCopyValue(byte tag, byte occurrence, short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength) throws NullPointerException, ArrayIndexOutOfBoundsException, ToolkitException(Code) | | Looks for the indicated occurrence of a TLV element from the
beginning of a TLV
list and copy its value into a destination buffer.
If no TLV element is found, the UNAVAILABLE_ELEMENT
exception is thrown.
If the method is successful then the corresponding TLV becomes current,
else no TLV is selected.
This search method is Comprehension Required flag independent.
Notes:
- If
dstOffset or
dstLength parameter is negative
an ArrayIndexOutOfBoundsException
exception is thrown and no copy is performed.
- If
dstOffset+dstLength is greater
than dstBuffer.length , the length
of the dstBuffer array an
ArrayIndexOutOfBoundsException exception
is thrown and no copy is performed.
Parameters: tag - the tag of the TLV element to search Parameters: occurrence - the occurrence number of the TLV element (1 for the first, 2 for the second...) Parameters: valueOffset - the offset of the first byte in the source TLV element Parameters: dstBuffer - a reference to the destination buffer Parameters: dstOffset - the position in the destination buffer Parameters: dstLength - the data length to be copied dstOffset + dstLength exception: NullPointerException - if dstBuffer is null exception: ArrayIndexOutOfBoundsException - if findAndCopyValue would cause access of data outside array bounds. exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV elementOUT_OF_TLV_BOUNDARIES if: valueOffset parameter is negative orvalueOffset + dstLength is greater than the length of the current TLV BAD_INPUT_PARAMETER if an input parameter is not valid (e.g. occurrence = 0)
|
findTLV | public byte findTLV(byte tag, byte occurrence) throws ToolkitException(Code) | | Looks for the indicated occurrence of a TLV element from the beginning of
the TLV list (handler buffer). If the method is successful then the
corresponding TLV becomes current, else no TLV is selected.
This search method is Comprehension Required flag independent.
Parameters: tag - the tag of the TLV element to search Parameters: occurrence - the occurrence number of the TLV element (1 for the first, 2 for the second...) result of the method: TLV_NOT_FOUND if the required occurrence of the TLV element does not existTLV_FOUND_CR_SET if the required occurrence existsand Comprehension Required flag is setTLV_FOUND_CR_NOT_SET if the required occurrence exists and Comprehension Required flag is not set
exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyBAD_INPUT_PARAMETER if an input parameter is notvalid (e.g. occurrence = 0)
|
getAPDUBuffer | public static byte[] getAPDUBuffer(byte[] buffer)(Code) | | Copies the APDUBuffer content into provided buffer.
Parameters: buffer - The buffer Provided buffer filled with APDUBuffer content |
getAPDUBuffer | public static byte[] getAPDUBuffer()(Code) | | Copies the APDUBuffer content into current buffer.
apdu buffer |
getLastTLVOffset | protected short getLastTLVOffset(byte[] buffer, short Lc)(Code) | | Helper method for getValue... and
copyValue... .
Parameters: buffer - APDU buffer Parameters: Lc - Length of command data Offset of the tag |
getLength | public short getLength() throws ToolkitException(Code) | | Returns the length of the TLV list.
length in bytes exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busy
|
getTLVOffset | protected short getTLVOffset(byte[] buffer, byte tag, short Lc, short occurrence)(Code) | | Helper method for findAndCompareValue .
Parameters: buffer - APDU buffer Parameters: tag - What tag we are finding Parameters: Lc - Length of command data Parameters: occurrence - The occurrence number of the TLV element Offset of the tag |
getValueByte | public byte getValueByte(short valueOffset) throws ToolkitException(Code) | | Gets a byte from the last TLV element which has been found in the
handler.
Parameters: valueOffset - the offset of the byte to return in the TLV element element value (1 byte) exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV elementOUT_OF_TLV_BOUNDARIES if valueOffset is out of the current TLV
|
getValueLength | public short getValueLength() throws ToolkitException(Code) | | Gets the binary length of the value field for the last TLV element
which has been found in the handler.
length of the value field exception: ToolkitException - with the following reason codes: HANDLER_NOT_AVAILABLE if the handler is busyUNAVAILABLE_ELEMENT in case of unavailable TLV element
|
setAPDUBuffer | public static void setAPDUBuffer(byte[] buffer, short length)(Code) | | Copies content of provided buffer into the APDUBuffer.
Parameters: buffer - The buffer Parameters: length - Length of the buffer |
setAPDUBuffer | public static void setAPDUBuffer(short length)(Code) | | Copies content of current buffer into the APDUBuffer.
Parameters: length - Length of the current buffer |
setOutBufferData | public static void setOutBufferData(short length)(Code) | | Sets the data in the out buffer.
Parameters: length - Length of data |
|
|