On this page
Class ResponseAPDU
- All Implemented Interfaces:
-
Serializable
public final class ResponseAPDU extends Object implements Serializable
Instances of this class are immutable. Where data is passed in or out via byte arrays, defensive cloning is performed.
- Since:
- 1.6
- See Also:
Constructor Summary
Constructor | Description |
---|---|
ResponseAPDU |
Constructs a ResponseAPDU from a byte array containing the complete APDU contents (conditional body and trailed).
|
Method Summary
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals |
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.
|
Constructor Details
ResponseAPDU
public ResponseAPDU(byte[] apdu)
Note that the byte array is cloned to protect against subsequent modification.
- Parameters:
apdu
- the complete response APDU- Throws:
NullPointerException
- if apdu is nullIllegalArgumentException
- if apdu.length is less than 2
Method Details
getNr
public int getNr()
getData().length
.
- Returns:
- the number of data bytes in the response body or 0 if this APDU has no body.
getData
public byte[] getData()
- Returns:
- a copy of the data bytes in the response body or the empty byte array if this APDU has no body.
getSW1
public int getSW1()
- Returns:
- the value of the status byte SW1 as a value between 0 and 255.
getSW2
public int getSW2()
- Returns:
- the value of the status byte SW2 as a value between 0 and 255.
getSW
public int getSW()
(getSW1() << 8) | getSW2()
- Returns:
- the value of the status word SW.
getBytes
public byte[] getBytes()
- Returns:
- a copy of the bytes in this APDU.
toString
public String toString()
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.smartcardio/javax/smartcardio/ResponseAPDU.html