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.

Transient reference to a byte array

JCIDE related questions and answers.

Moderators: product, kuafu

kosullivan
Posts: 34
Joined: Mon Jun 29, 2015 9:03 pm
Points :616
Contact:

Transient reference to a byte array

Post by kosullivan » Wed Jul 05, 2017 12:38 pm

Hi folks,

I'm trying to write a data parsing class in Javacard and I want to store a transient pointer to the data buffer inside the class instance, so I don't have to keep passing the array, offset and length every call.

An example of how it would be used is:

Code: Select all

DataParser parser = new DataParser(); // Created in the Applet constructor

parser.setData(buffer, offset, length);
byte a = parser.readNextByte();
short b = parser.readNextShort();
short c = parser.readNextShort();

Is there any way in Javacard for a class to store a reference to a byte array without it being persistent?
Thanks,
kos

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Transient reference to a byte array

Post by UNKNwYSHSA » Wed Jul 05, 2017 10:19 pm

You can store the reference to a array created by JC API: JCSystem.makeTransientObjectArray(...).
Hope that is what you need.
sense and simplicity

kosullivan
Posts: 34
Joined: Mon Jun 29, 2015 9:03 pm
Points :616
Contact:

Re: Transient reference to a byte array

Post by kosullivan » Thu Aug 17, 2017 11:52 am

Hi, apologies for not replying to this for so long. This is exactly what I was after, thanks :)

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 18 guests

JavaCard OS : Disclaimer