**javacardx.external** ====Class Memory ==== *[[javacard:java-card-api:object|java.lang.Object]] \\ ---- public final class **Memory**extends [[javacard:java-card-api:Object|Object]] This class provides access to memory subsystems that are not directly addressable, typically that of other contactless state machine handlers such as MifareTM. This class could also be used to access specialized memory spaces such as that of a mass storage device. **Since:** 2.2.2 ---- ^ Field Summary ^^ | **static byte** | **[[javacard:java-card-api:Memory#MEMORY_TYPE_EXTENDED_STORE|MEMORY_TYPE_EXTENDED_STORE]] **          Extended Memory Store type constant. | | **static byte** | **[[javacard:java-card-api:Memory#MEMORY_TYPE_MIFARE|MEMORY_TYPE_MIFARE]] **          MIFARETM memory type constant. |   ^ Method Summary ^^ | **static [[javacard:java-card-api:MemoryAccess|MemoryAccess]] ** | **[[javacard:java-card-api:Memory#getMemoryAccessInstance(byte, short[], short)|getMemoryAccessInstance]] **(byte memoryType,short[] memorySize,short memorySizeOffset)          Creates a MemoryAccess object instance for the selected memory subsystem. |   ^ Methods inherited from class java.lang.Object ^ | [[javacard:java-card-api:Object#equals(java.lang.Object)|equals]] |   ^ Field Detail ^ === MEMORY_TYPE_MIFARE === public static final byte **MEMORY_TYPE_MIFARE** MIFARETM memory type constant. When a MemoryAccess instance of this type is requested, the memorySize and memorySizeOffset parameters are ignored. To use the MemoryAccess instance the following parameters are applicable : \\ *//auth_key is an 8 byte password, other_len < =16// \\ *//other_sector = 0, 0 < = other_block < = 63// \\ *//other_block = (%4==3) returns 0 on readData// \\ *//other_block = 0 returns false on writeData// \\ **See Also:**[[javacard:java-card-api:constant-values#javacardx.external.Memory.MEMORY_TYPE_MIFARE|Constant Field Values]] ---- === MEMORY_TYPE_EXTENDED_STORE === public static final byte **MEMORY_TYPE_EXTENDED_STORE** Extended Memory Store type constant. When a MemoryAccess instance of this type is requested, the memorySize parameter contains the 32 bit number representing the size in bytes of the memory access required and must be a positive number less than or equal to 2,147,483,647 (2^31 - 1). To use the MemoryAccess instance the following parameters are applicable. \\ *//auth_key parameter is not required; it is ignored// \\ *//other_len < = 32767// \\ *//(other_sector, other_block) concatenated is a 32 bit address// \\ Note. \\ *// To ensure optimal performance on all mass storage memory types when accessing different areas of memory, use monotonically increasing addresses.// \\ *//Each time the //getMemoryAccessInstance// method is called with this memory type parameter, a new memory access object to access a distinct memory chunk is returned. A previously obtained memory access object cannot be used to access the memory chunk obtained via this new memory access object. The new memory access object cannot be used to access the memory chuck accessible via any previously allocated memory access object.// \\ **See Also:**[[javacard:java-card-api:constant-values#javacardx.external.Memory.MEMORY_TYPE_EXTENDED_STORE|Constant Field Values]] ^ Method Detail ^ === getMemoryAccessInstance === public static final [[javacard:java-card-api:MemoryAccess|MemoryAccess]] **getMemoryAccessInstance**(byte memoryType, short[] memorySize, short memorySizeOffset) throws [[javacard:java-card-api:ExternalException|ExternalException]] Creates a MemoryAccess object instance for the selected memory subsystem. **Parameters:**memoryType - the desired external memory subsystem. Valid codes listed in MEMORY_TYPE_* constants above, for example [[javacard:java-card-api:Memory#MEMORY_TYPE_MIFARE|MEMORY_TYPE_MIFARE]] . memorySize - the array containing the desired size in bytes, if applicable, in the external memory subsystem. Check the descriptions of the MEMORY_TYPE_* constants above for more details. The 32 bit number representing the memory size in bytes is formed by concatenating the two short values at offset memorySizeOffset (most significant 16 bits) and memorySizeOffset+1 (least significant 16 bits) in this array memorySizeOffset - the offset within the memorySize array where the 32 bit memory size number in bytes is specified **Returns:**the MemoryAccess object instance of the requested memory subsystem **Throws:** [[javacard:java-card-api:ExternalException|ExternalException]] - with the following reason codes: \\ *ExternalException.NO_SUCH_SUBSYSTEM if the requested memory subsystem is not available. \\ *ExternalException.INVALID_PARAM if the memorySize parameter isinvalid. \\