Is there any way to get the EEPROM size of a Java Card?
Posted: Wed Mar 06, 2019 4:59 am
Is there any way to get the EEPROM size of a Java Card?
JavaCardOS - JavaCardForum
https://javacardos.com/javacardforum/
https://javacardos.com/javacardforum/viewtopic.php?f=15&t=2014
Code: Select all
/**
* Obtains the amount of memory of the specified type that is available to
* the applet. Note that implementation-dependent memory overhead structures
* may also use the same memory pool.
* <p>
* Notes:
* <ul>
* <li><em>The number of bytes returned is only an upper bound on the amount
* of memory available due to overhead requirements.</em>
* <li><em>Allocation of CLEAR_ON_RESET transient objects may affect the
* amount of CLEAR_ON_DESELECT transient memory available.</em>
* <li><em>Allocation of CLEAR_ON_DESELECT transient objects may affect the
* amount of CLEAR_ON_RESET transient memory available.</em>
* <li><em>If the number of available bytes is greater than 32767, then
* this method returns 32767.</em>
* <li><em>The returned count is not an indicator of the size of object which
* may be created since memory fragmentation is possible.</em>
* </ul>
*
* @param memoryType
* the type of memory being queried. One of the
* <CODE>MEMORY_TYPE_*</CODE> constants defined above. See
* {@link #MEMORY_TYPE_PERSISTENT MEMORY_TYPE_PERSISTENT}.
* @return the upper bound on available bytes of memory for the specified
* type
* @exception SystemException
* with the following reason codes:
* <ul>
* <li><code>SystemException.ILLEGAL_VALUE</code> if
* <code>memoryType</code> is not a valid memory type.
* </ul>
*/
public static short getAvailableMemory(byte memoryType)
throws SystemException {