Class JCint
java.lang.Object
javacardx.framework.util.intx.JCint
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:
-
Method Summary
Modifier and TypeMethodDescriptionstatic final intgetInt(byte[] bArray, short bOff) Concatenates four bytes in a byte array to form a int value.static final intmakeInt(byte b1, byte b2, byte b3, byte b4) Concatenates the four parameter bytes to form an int value.static final intmakeInt(short s1, short s2) Concatenates the two parameter short values to form an int value.static int[]makeIntArrayView(int[] array, short offset, short length, short attributes, Shareable service) Creates an int array which is a view on the specifiedarrayparameter.static int[]makeTransientIntArray(short length, byte event) Creates a transient int array with the specified array length.static final shortsetInt(byte[] bArray, short bOff, int iValue) Deposits the int value as four successive bytes at the specified offset in the byte array.
-
Method Details
-
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 byteb3- the third byteb4- 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 arraybOff- offset within byte array containing first byte (the high order byte)- Returns:
- the int value the concatenated result
- Throws:
NullPointerException- if thebArrayparameter isnullArrayIndexOutOfBoundsException- if thebOffparameter is negative or ifbOff+4is greater than the length ofbArray
-
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 arraybOff- offset within byte array to deposit the first byte (the high order byte)iValue- the short value to set into array.- Returns:
bOff+4Note:
- If the byte array is persistent, this operation is performed atomically.
If the commit capacity is exceeded, no operation is performed and a
TransactionExceptionexception is thrown.
- If the byte array is persistent, this operation is performed atomically.
If the commit capacity is exceeded, no operation is performed and a
- Throws:
TransactionException- if the operation would cause the commit capacity to be exceededNullPointerException- if thebArrayparameter isnullArrayIndexOutOfBoundsException- if thebOffparameter is negative or ifbOff+4is greater than the length ofbArray- See Also:
-
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 arrayevent- theCLEAR_ON...event which causes the array elements to be cleared- Returns:
- the new transient int array
- Throws:
NegativeArraySizeException- if thelengthparameter is negativeSystemException- with the following reason codes:SystemException.ILLEGAL_VALUEif event is not a valid event code.SystemException.NO_TRANSIENT_SPACEif sufficient transient space is not available.SystemException.ILLEGAL_TRANSIENTif the current applet context is not the currently selected applet context andCLEAR_ON_DESELECTis specified.
- See Also:
-