Christmas is coming!

To celebrate the new year and thank for the support from all our dear customers, Christmas promotional activity is being held in JavaCardOS online store.

During the event, you can enjoy many promotional activities - High Discount on JavaCardOS products,Lucky Draw,Double forum Points.

Come to choose your own Christmas gift and try your luck now!

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: 350
Contact:

Transient reference to a byte array

Postby 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: 628
Joined: Thu May 21, 2015 4:05 am
Points: 2971
Contact:

Re: Transient reference to a byte array

Postby 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: 350
Contact:

Re: Transient reference to a byte array

Postby 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 :)


Return to “Questions & Answers”

Who is online

Users browsing this forum: No registered users and 1 guest

JavaCard OS : Disclaimer