com.datecs.api.smartcard
Class AnswerToReset

java.lang.Object
  extended by com.datecs.api.smartcard.AnswerToReset

public final class AnswerToReset
extends java.lang.Object

This class represents the smart card response ATR as defined in ISO/IEC 7816-4.

Instances of this class are immutable. Where data is passed in or out via byte arrays, defensive cloning is performed.


Field Summary
static int PROTOCOL_T0
          ISO/IEC 7816-4 transport protocol type T=0.
static int PROTOCOL_T1
          ISO/IEC 7816-4 transport protocol type T=1.
 
Constructor Summary
AnswerToReset(byte[] atr)
          Constructs a new instance of this class from a given byte array.
 
Method Summary
 byte[] getBytes()
          Returns a copy of the bytes in this ATR.
 byte[] getData()
          Returns a copy of the data bytes in the response body.
 int getProtocol()
          Returns a smart card communication protocol.
 java.lang.String toString()
          Returns the string representation of object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTOCOL_T0

public static final int PROTOCOL_T0
ISO/IEC 7816-4 transport protocol type T=0.

See Also:
Constant Field Values

PROTOCOL_T1

public static final int PROTOCOL_T1
ISO/IEC 7816-4 transport protocol type T=1.

See Also:
Constant Field Values
Constructor Detail

AnswerToReset

public AnswerToReset(byte[] atr)
Constructs a new instance of this class from a given byte array.

If atr is null, a NullPointerException is thrown.

if atr.length < 1, a IllegalArgumentException is thrown.

Parameters:
atr - the byte array containing the answer-to-reset bytes.
Method Detail

getProtocol

public int getProtocol()
Returns a smart card communication protocol.

The protocols are defined like PROTOCOL_* constant field values.

Returns:
a smart card communication protocol.

getData

public byte[] getData()
Returns a copy of the data bytes in the response body.

Returns:
a copy of the data bytes in the response body.

getBytes

public byte[] getBytes()
Returns a copy of the bytes in this ATR.

Returns:
a copy of the bytes in this ATR.

toString

public java.lang.String toString()
Returns the string representation of object.

Overrides:
toString in class java.lang.Object