javax.smartcardio

## Class ATR

- java.lang.Object
- - javax.smartcardio.ATR

- All Implemented Interfaces:
    java.io.Serializable

      public final class ATR
      extends java.lang.Object
      implements java.io.Serializable

  A Smart Card's answer-to-reset bytes. A Card's ATR object can be obtained by calling Card.getATR(). This class does not attempt to verify that the ATR encodes a semantically valid structure.

  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:
    `Card.getATR()`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ATR(byte[] atr)` Constructs an ATR from a byte array.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)` Compares the specified object with this ATR for equality.
    `byte[]` | `getBytes()` Returns a copy of the bytes in this ATR.
    `byte[]` | `getHistoricalBytes()` Returns a copy of the historical bytes in this ATR.
    `int` | `hashCode()` Returns the hash code value for this ATR.
    `java.lang.String` | `toString()` Returns a string representation of this ATR.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ATR

          public ATR(byte[] atr)

      Constructs an ATR from a byte array.
      Parameters:
        `atr` - the byte array containing the answer-to-reset bytes
      Throws:
        `java.lang.NullPointerException` - if `atr` is null

  - ### Method Detail

    - #### getBytes

          public byte[] getBytes()

      Returns a copy of the bytes in this ATR.
      Returns:
        a copy of the bytes in this ATR.

    - #### getHistoricalBytes

          public byte[] getHistoricalBytes()

      Returns a copy of the historical bytes in this ATR. If this ATR does not contain historical bytes, an array of length zero is returned.
      Returns:
        a copy of the historical bytes in this ATR.

    - #### toString

          public java.lang.String toString()

      Returns a string representation of this ATR.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a String representation of this ATR.

    - #### equals

          public boolean equals(java.lang.Object obj)

      Compares the specified object with this ATR for equality. Returns true if the given object is also an ATR and its bytes are identical to the bytes in this ATR.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object to be compared for equality with this ATR
      Returns:
        true if the specified object is equal to this ATR

    - #### hashCode

          public int hashCode()

      Returns the hash code value for this ATR.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        the hash code value for this ATR.