Page 1 of 1

confused with the API methods

Posted: Mon Jun 13, 2016 3:57 am
by jbsoft
I am a little confused with the methods receiveBytes(short bOff) and sendBytesLong(byte[] outData, short bOff, short len).

1. receiveBytes(short bOff)
For this method, is it used to receive data and put it into APDU buffer, starting at the offset bOff?

2.sendBytesLong(byte[] outData, short bOff, short len)
Why does this method send data directly from the array "outData"? Don't you need to copy it into APDU buffer firstly?

Thanks

Re: confused with the API methods

Posted: Mon Jun 13, 2016 5:46 am
by cprgolds
receiveBytes(short bOff) is to receive data from card OS and store it in APDU buffer.

You can send byte array directly via sendBytesLong(byte[] outData, short bOff, short len). I mean you don't have to copy data to APDU buffer first.

Re: confused with the API methods

Posted: Wed Jun 15, 2016 1:30 am
by notuo
receiveBytes(short bOff) method retrieves data from the card OS and populates the APDU buffer.

You don't have to copy data to APDU buffer because the JCRE does the copy for you.