|
Java Smart Card I/O | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.smartcardio.ResponseAPDU
public final class ResponseAPDU
A response APDU as defined in ISO/IEC 7816-4. It consists of a conditional body and a two byte trailer. This class does not attempt to verify that the APDU encodes a semantically valid response.
Instances of this class are immutable. Where data is passed in or out via byte arrays, defensive cloning is performed.
CommandAPDU
,
CardChannel.transmit
,
Serialized FormConstructor Summary | |
---|---|
ResponseAPDU(byte[] apdu)
Constructs a ResponseAPDU from a byte array containing the complete APDU contents (conditional body and trailed). |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Compares the specified object with this response APDU for equality. |
byte[] |
getBytes()
Returns a copy of the bytes in this APDU. |
byte[] |
getData()
Returns a copy of the data bytes in the response body. |
int |
getNr()
Returns the number of data bytes in the response body (Nr) or 0 if this APDU has no body. |
int |
getSW()
Returns the value of the status bytes SW1 and SW2 as a single status word SW. |
int |
getSW1()
Returns the value of the status byte SW1 as a value between 0 and 255. |
int |
getSW2()
Returns the value of the status byte SW2 as a value between 0 and 255. |
int |
hashCode()
Returns the hash code value for this response APDU. |
String |
toString()
Returns a string representation of this response APDU. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ResponseAPDU(byte[] apdu)
Note that the byte array is cloned to protect against subsequent modification.
apdu
- the complete response APDU
NullPointerException
- if apdu is null
IllegalArgumentException
- if apdu.length is less than 2Method Detail |
---|
public int getNr()
getData().length
.
public byte[] getData()
public int getSW1()
public int getSW2()
public int getSW()
(getSW1() << 8) | getSW2()
.
public byte[] getBytes()
public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
obj
- the object to be compared for equality with this response APDU
public int hashCode()
hashCode
in class Object
|
Java Smart Card I/O | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |