Christmas is coming soon! To thank for the support from all our dear customers, Christmas promotional activity is going on in JavaCardOS online store. For more activities details, please check this post.

Transient reference to a byte array

JCIDE related questions and answers.

Moderators: product, kuafu

kosullivan
Posts: 25
Joined: Mon Jun 29, 2015 9:03 pm
Points :354
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 :3027
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: 25
Joined: Mon Jun 29, 2015 9:03 pm
Points :354
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 1 guest

JavaCard OS : Disclaimer