Java Card API

jcint

2017-05-22 16:48:43 M&W SmartCard 27

javacardx.framework.util.intx

Class JCint


public final class JCintextends Object

The JCint class contains common utility functions using ints. Some of the methods may be implemented as native functions for performance reasons. All the methods in JCint class are static methods. The methods makeTransientIntArray() and and setInt(), refer to the persistence of array objects. The term persistent means that arrays and their values persist from one CAD session to the next, indefinitely. The makeTransientIntArray() method is used to create transient int arrays. Constants related to transience control are available in the JCSystem class.

Since:

2.2.2

See Also:javacard.framework.JCSystem


Method Summary
static int getInt (byte[] bArray,short bOff)          Concatenates four bytes in a byte array to form a int value.
static int makeInt (byte b1,byte b2,byte b3,byte b4)          Concatenates the four parameter bytes to form an int value.
static int makeInt (short s1,short s2)          Concatenates the two parameter short values to form an int value.
static int[] makeTransientIntArray (short length,byte event)          Creates a transient int array with the specified array length.
static short setInt (byte[] bArray,short bOff,int iValue)          Deposits the int value as four successive bytes at the specified offset in the byte array.

 

Methods inherited from class java.lang.Object
equals

 

Method Detail

makeInt

public static final int makeInt(byte b1, byte b2, byte b3, byte b4)

Concatenates the four parameter bytes to form an int value.

Parameters:b1 - the first byte ( high order byte )

b2 - the second byte

b3 - the third byte

b4 - the fourth byte ( low order byte )

Returns:the int value the concatenated result


makeInt

public static final int makeInt(short s1, short s2)

Concatenates the two parameter short values to form an int value.

Parameters:s1 - the first short value ( high order short value )

s2 - the second short value ( low order short value )

Returns:the int value the concatenated result


getInt

public static final int getInt(byte[] bArray, short bOff) throws NullPointerException , ArrayIndexOutOfBoundsException

Concatenates four bytes in a byte array to form a int value.

Parameters:bArray - byte array

bOff - offset within byte array containing first byte (the high order byte)

Returns:the int value the concatenated result

Throws: NullPointerException- if the bArray parameter is null

ArrayIndexOutOfBoundsException- if the bOff parameter is negative or if bOff+4 is greater than the length of bArray


setInt

public static final short setInt(byte[] bArray, short bOff, int iValue) throws TransactionException , NullPointerException , ArrayIndexOutOfBoundsException

Deposits the int value as four successive bytes at the specified offset in the byte array.

Parameters:bArray - byte array

bOff - offset within byte array to deposit the first byte (the high order byte)

iValue - the short value to set into array.

Returns:bOff+4 Note:

  • If the byte array is persistent, this operation is performed atomically. If the commit capacity is exceeded, no operation is performed and a TransactionException exception is thrown.


Throws: TransactionException- if the operation would cause the commit capacity to be exceeded

NullPointerException- if the bArray parameter is null

ArrayIndexOutOfBoundsException- if the bOff parameter is negative or if bOff+4 is greater than the length of bArray

See Also:javacard.framework.JCSystem.getUnusedCommitCapacity()


makeTransientIntArray

public static int[] makeTransientIntArray(short length, byte event) throws NegativeArraySizeException , SystemException

Creates a transient int array with the specified array length.

Parameters:length - the length of the int array

event - the CLEAR_ON… event which causes the array elements to be cleared

Returns:the new transient int array

Throws: NegativeArraySizeException- if the length parameter is negative

SystemException- with the following reason codes:

  • SystemException.ILLEGAL_VALUE if event is not a valid event code.


  • SystemException.NO_TRANSIENT_SPACE if sufficient transient space is not available.


  • SystemException.ILLEGAL_TRANSIENT if the current applet context is not the currently selected applet context and CLEAR_ON_DESELECT is specified.


See Also:javacard.framework.JCSystem


Home
Product
News
Contact us