Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Is there any way to get the EEPROM size of a Java Card?

JavaCard Applet Development Related Questions and Answers.
xiaoxiancai
Posts: 3
Joined: Sat Dec 15, 2018 9:35 am
Points :40
Contact:

Is there any way to get the EEPROM size of a Java Card?

Post by xiaoxiancai » Wed Mar 06, 2019 4:59 am

Is there any way to get the EEPROM size of a Java Card?

bigWhite
Posts: 35
Joined: Tue Aug 25, 2015 8:21 am
Points :502
Contact:

Re: Is there any way to get the EEPROM size of a Java Card?

Post by bigWhite » Thu Mar 07, 2019 11:30 pm

hello,

You can get it from the card supplier, or use the following API function to get.

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 {

BirdKing
Posts: 86
Joined: Wed Nov 04, 2015 7:23 am
Points :656
Contact:

Re: Is there any way to get the EEPROM size of a Java Card?

Post by BirdKing » Fri Mar 15, 2019 5:45 am

Note, the return value type of getAvailableMemory() is short. It max value 32767. If getAvailableMemory() returned 32767, you should called this method again to check wether the card has more memory.

xiaoxiancai
Posts: 3
Joined: Sat Dec 15, 2018 9:35 am
Points :40
Contact:

Re: Is there any way to get the EEPROM size of a Java Card?

Post by xiaoxiancai » Fri Apr 12, 2019 5:58 am

Can anyone share some code about getting the EEPROM?
thanks.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 52 guests

JavaCard OS : Disclaimer