Class CommandAPDU

java.lang.Object
javax.smartcardio.CommandAPDU
All Implemented Interfaces:
Serializable

public final class CommandAPDU extends Object implements Serializable
A command APDU following the structure defined in ISO/IEC 7816-4. It consists of a four byte header and a conditional body of variable length. This class does not attempt to verify that the APDU encodes a semantically valid command.

Note that when the expected length of the response APDU is specified in the constructors, the actual length (Ne) must be specified, not its encoded form (Le). Similarly, getNe() returns the actual value Ne. In other words, a value of 0 means "no data in the response APDU" rather than "maximum length."

This class supports both the short and extended forms of length encoding for Ne and Nc. However, note that not all terminals and Smart Cards are capable of accepting APDUs that use the extended form.

For the header bytes CLA, INS, P1, and P2 the Java type int is used to represent the 8 bit unsigned values. In the constructors, only the 8 lowest bits of the int value specified by the application are significant. The accessor methods always return the byte as an unsigned value between 0 and 255.

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: