JAVA Card Objects
Memory parts for JAVA CARD:
A. ROM: Permanently Save the program and data, virtual machine, API, etc. (applets can also be put here)
B. RAM: Stack data, temporary object;
C. Eeprom:applet class, Long life cycle data; (write operation 1000 times times slower than RAM)
Thus, ROM is the basic program and data that holds jcre, while RAM is used to hold the temporary data required for the current session, and Eepro is used to hold the data across sessions.
The following are described separately:
1. ROM:
When masking, the data is fixed and the entire card life cycle does not change. Unless you save the applets to this area.
2. RAM:
Temporary data, arrays, and objects that are saved during the applet run. Temporary data is a stack of data, intermediate data in the process of running the program, and temporary objects, it is not so simple. The temporary object is not the object is temporary, but the object's data is temporary, an applet in the lifetime of a temporary object is established only once, and the object's reference to save in a permanent domain. Only arrays with primitive type components or data with an object reference type component are temporary, where the polygons include temporary arrays and temporary objects.
Temporary objects are built through APIs, data cannot span two CAD sessions, and modifications to a domain are not atomic.
The properties of a temporary object make it an ideal object for a small amount of temporary applet data to be modified frequently, but without having to be kept between CAD sessions. There are two types of temporary data objects, Clear_on_reset and Clear_on_deselect. Note that when the card is reset, the data of the temporary object is also emptied when the clear_on_deselect is defined.
Methods for establishing a temporary array in class Jcsystem
Result of Method method invocation
public static boolean[]
Maketransientbooleanarray (short Length,byte event) Create a temporary Boolean array
public static byte[]
Maketransientbytearray (short Length,byte event) create a temporary byte array
public static short[]
Maketransientshortarray (short Length,byte event) create a temporary short array
public static object[]
Maketransientobjectarray (short Length,byte event) create an array of temporary objects
3. EEPROM:
Use the new action symbol to set up, you can keep the same across CAD sessions, the modification to a single domain is atomic, can be referenced by a temporary object, or it can refer to a temporary object.
In front of the three types of memory to discuss how to use, in fact, for application development, only the ROM and EEPROM, that is, temporary data and the difference between permanent data, the most important point is to establish the method is different, one is the API establishment, a direct new. So, we get an object that could have been built through the API, or it might be new, at this time, we can pass: public static byte Istransient (Objecttheobject) The return value is determined to be: Clear_on_ RESET or Clear_on_deselect or Jcsystem.not_a_transient_object indicates the object's properties, and you know where the object is stored.
About optimizations:
Smart card resources are very limited and cannot be unrestricted or cluttered with new or temporary data, otherwise it is easy to throw an exception because there is not enough space. Because the data is released through new or API application space, the release (requestobjectdeletion) is slow, and even the card does not support the garbage collection mechanism.
Reference book: Java Card for smart card
Description: "Java Card Application Development" series of blog is I in the process of Learning Java card record, there is a wrong place, please point out.