How use transient object to manage my File System ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   hman_wizard
Posted On:   Thursday, November 29, 2001 04:48 AM

I would like to know how use the transient objects to access my File system on my javacard.



I saw JavaPurse example in JDK 2.1.2 but it's very hard for javacard applet beginners developers.



Can you help me with a sample or document or other ??



Thanks



h-man

Re: How use transient object to manage my File System ?

Posted By:   Clement_SIMON  
Posted On:   Monday, December 3, 2001 01:13 AM

Could you be more specific, please ? Why do you need transient arrays to access your filesystem ?

Is it absolutely necessary for you to use transient data ?


While waiting for your input, here is a little clarification on what transient data is.


It's a common misconception to think that there are transient objects in JavaCard.

There are transient arrays, not transient objects.


In the case of a transient object array, you create an array of transient references to persistent objects.

The objects are not transient, but their references will be.


Let's review the following code :


byte[] transientArray = JCSystem.makeTransientObjectArray((short) 5, JCSystem.CLEAR_ON_DESELECT);


transientArray[0] = new OwnerPIN((byte)3, (byte)5);


I have created an array that can contain 5 transient references that will be cleared on applet deselection.


Then, I create a persistent OwnerPIN object (anything created by new() is persistent), and store the reference in the transient array.


From the memory point of view :


  • the reference 'transientArray' is stored in EEPROM
  • the contents of 'transientArray' are stored in RAM
  • the reference of the OwnerPIN object is stored in RAM
  • the contents of the OwnerPIN object are stored in EEPROM


Now, if the applet is deselected, the reference will be lost and the OwnerPIN object will become unreachable unless I save the reference somewhere else in persistent data.


I must insist on the fact that it's not possible to create a transient object, just arrays of transient references.

About | Sitemap | Contact