Announce two new product: SmartCard Reader Rockey200 and USB2.0 Extension Cable

ROCKEY 200 is a handy and portable USB Smart Card reader that can perform read/write operations on any ISO 7816-1/2/3/4 smart cards which are compatible with protocol T=0 and T=1.

USB2.0 Extension Cable With high speed USB 2.0 devices such as USB token ,USB Card Reader and so on.

Come to try it 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: 354
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: 2975
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: 354
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