Package uicc.toolkit
Interface ViewHandler
-
- All Known Subinterfaces:
BERTLVEditHandler,BERTLVViewHandler,EditHandler,EnvelopeHandler,EnvelopeResponseHandler,ProactiveHandler,ProactiveResponseHandler
public interface ViewHandlerTheViewHandlerclass offers basic services and contains basic methods to handle a Comprehension 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 Comprehension TLV.- See Also:
ToolkitException
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description bytecompareValue(short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength)Compares the last found TLV element with a buffer.shortcopy(byte[] dstBuffer, short dstOffset, short dstLength)Copies the Comprehension TLV list contained in the handler to the destination byte array.shortcopyValue(short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength)Copies a part of the last TLV element which has been found, into a destination buffer.bytefindAndCompareValue(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.bytefindAndCompareValue(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.shortfindAndCopyValue(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.shortfindAndCopyValue(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.bytefindTLV(byte tag, byte occurrence)Looks for the indicated occurrence of a TLV element from the beginning of the TLV list (handler buffer).shortgetCapacity()Returns the maximum size of the Comprehension TLV list managed by the handler.shortgetLength()Returns the length of the TLV list.bytegetValueByte(short valueOffset)Gets a byte from the last TLV element which has been found in the handler.shortgetValueLength()Gets the binary length of the value field for the last TLV element which has been found in the handler.shortgetValueShort(short valueOffset)Gets a short from the last TLV element which has been found in the handler.
-
-
-
Method Detail
-
getLength
short getLength() throws ToolkitExceptionReturns the length of the TLV list.- Returns:
- length in bytes
- Throws:
ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busy
-
copy
short copy(byte[] dstBuffer, short dstOffset, short dstLength) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitExceptionCopies the Comprehension TLV list contained in the handler to the destination byte array.- Parameters:
dstBuffer- a reference to the destination bufferdstOffset- the position in the destination bufferdstLength- the data length to be copied- Returns:
dstOffset+dstLength- Throws:
java.lang.NullPointerException- ifdstBufferisnulljava.lang.ArrayIndexOutOfBoundsException- ifdstOffsetordstLengthor both would cause access outside array bounds, or ifdstLengthis negative.ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyOUT_OF_TLV_BOUNDARIESifdstLengthis grater than the length of the Comprehension TLV List.
-
findTLV
byte findTLV(byte tag, byte occurrence) throws ToolkitExceptionLooks 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 searchoccurrence- the occurrence number of the TLV element (1 for the first, 2 for the second...)- Returns:
- result of the method:
TLV_NOT_FOUNDif the required occurrence of the TLV element does not existTLV_FOUND_CR_SETif the required occurrence exists and Comprehension Required flag is setTLV_FOUND_CR_NOT_SETif the required occurrence exists and Comprehension Required flag is not set
- Throws:
ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyBAD_INPUT_PARAMETERif an input parameter is not valid (e.g. occurrence = 0)
-
getValueLength
short getValueLength() throws ToolkitExceptionGets the binary length of the value field for the last TLV element which has been found in the handler.- Returns:
- length of the value field
- Throws:
ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV element
-
getValueByte
byte getValueByte(short valueOffset) throws ToolkitExceptionGets 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- Returns:
- element value (1 byte)
- Throws:
ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV elementOUT_OF_TLV_BOUNDARIESifvalueOffsetis out of the current TLV
-
getValueShort
short getValueShort(short valueOffset) throws ToolkitExceptionGets a short from the last TLV element which has been found in the handler.- Parameters:
valueOffset- the offset of the short to return in the TLV element- Returns:
- element value (1 short)
- Throws:
ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV elementOUT_OF_TLV_BOUNDARIESifvalueOffsetis out of the current TLV
-
copyValue
short copyValue(short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitExceptionCopies a part of the last TLV element which has been found, into a destination buffer.- Parameters:
valueOffset- the offset of the first byte in the source TLV elementdstBuffer- a reference to the destination bufferdstOffset- the position in the destination bufferdstLength- the data length to be copied- Returns:
dstOffset+dstLength- Throws:
java.lang.NullPointerException- ifdstBufferisnulljava.lang.ArrayIndexOutOfBoundsException- ifdstOffsetordstLengthor both would cause access outside array bounds, or ifdstLengthis negative.ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV elementOUT_OF_TLV_BOUNDARIESifvalueOffset,dstLengthor both are out of the current TLV
-
compareValue
byte compareValue(short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitExceptionCompares the last found TLV element with a buffer.- Parameters:
valueOffset- the offset of the first byte to compare in the TLV elementcompareBuffer- a reference to the comparison buffercompareOffset- the position in the comparison buffercompareLength- the length to be compared- Returns:
- the result of the comparison as follows:
0if identical-1if the first miscomparing byte in Comprehension TLV List is less than that incompareBuffer,1if the first miscomparing byte in Comprehension TLV List is greater than that incompareBuffer.
- Throws:
java.lang.NullPointerException- ifcompareBufferisnulljava.lang.ArrayIndexOutOfBoundsException- ifcompareOffsetorcompareLengthor both would cause access outside array bounds, or ifcompareLengthis negative.ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV elementOUT_OF_TLV_BOUNDARIESifvalueOffset,compareLengthor both are out of the current TLV
-
findAndCopyValue
short findAndCopyValue(byte tag, byte[] dstBuffer, short dstOffset) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitExceptionLooks 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, theUNAVAILABLE_ELEMENTexception 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.- Parameters:
tag- the tag of the TLV element to searchdstBuffer- a reference to the destination bufferdstOffset- the position in the destination buffer- Returns:
dstOffset+ length of the copied value- Throws:
java.lang.NullPointerException- ifdstBufferisnulljava.lang.ArrayIndexOutOfBoundsException- ifdstOffsetwould cause access outside array boundsToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV element
-
findAndCopyValue
short findAndCopyValue(byte tag, byte occurrence, short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitExceptionLooks 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, theUNAVAILABLE_ELEMENTexception 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.- Parameters:
tag- the tag of the TLV element to searchvalueOffset- the offset of the first byte in the source TLV elementdstBuffer- a reference to the destination bufferdstOffset- the position in the destination bufferdstLength- the data length to be copiedoccurrence- the occurrence number of the TLV element (1 for the first, 2 for the second ...)- Returns:
dstOffset + dstLength- Throws:
java.lang.NullPointerException- ifdstBufferisnulljava.lang.ArrayIndexOutOfBoundsException- ifdstOffsetordstLengthor both would cause access outside array bounds, or ifdstLengthis negative.ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV elementOUT_OF_TLV_BOUNDARIESifvalueOffset,dstLengthor both are out of the current TLVBAD_INPUT_PARAMETERif an input parameter is not valid (e.g.occurrence = 0)
-
findAndCompareValue
byte findAndCompareValue(byte tag, byte[] compareBuffer, short compareOffset) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitExceptionLooks 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, theUNAVAILABLE_ELEMENTexception 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.- Parameters:
tag- the tag of the TLV element to searchcompareBuffer- a reference to the comparison buffercompareOffset- the position in the comparison buffer- Returns:
- the result of the comparison as follows:
0if identical-1if the first miscomparing byte in Comprehension TLV is less than that incompareBuffer,1if the first miscomparing byte in Comprehension TLV is greater than that incompareBuffer.
- Throws:
java.lang.NullPointerException- ifcompareBufferisnulljava.lang.ArrayIndexOutOfBoundsException- ifcompareOffsetwould cause access outside array boundsToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV element
-
findAndCompareValue
byte findAndCompareValue(byte tag, byte occurrence, short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException, ToolkitExceptionLooks 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, theUNAVAILABLE_ELEMENTexception 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.- Parameters:
tag- the tag of the TLV element to searchvalueOffset- the offset of the first byte in the source TLV elementcompareBuffer- a reference to the comparison buffercompareOffset- the position in the comparison buffercompareLength- the length to be comparedoccurrence- the occurrence number of the TLV element (1 for the first, 2 for the second ...)- Returns:
- the result of the comparison as follows:
0if identical-1if the first miscomparing byte in Comprehension TLV is less than that incompareBuffer,1if the first miscomparing byte in Comprehension TLV is greater than that incompareBuffer.
- Throws:
java.lang.NullPointerException- ifcompareBufferisnulljava.lang.ArrayIndexOutOfBoundsException- ifcompareOffsetorcompareLengthor both would cause access outside array bounds, or ifcompareLengthis negative.ToolkitException- with the following reason codes:HANDLER_NOT_AVAILABLEif the handler is busyUNAVAILABLE_ELEMENTin case of unavailable TLV elementOUT_OF_TLV_BOUNDARIESifvalueOffset,compareLengthor both are out of the current TLVBAD_INPUT_PARAMETERif an input parameter is not valid (e.g.occurence = 0)
-
getCapacity
short getCapacity() throws ToolkitExceptionReturns the maximum size of the Comprehension TLV list managed by the handler.- Returns:
- size in byte
- Throws:
ToolkitException- - with the following reason codes:- HANDLER_NOT_AVAILABLE if the handler is busy
-
-