Class ResponseAPDU


  • public class ResponseAPDU
    extends APDU
    A ResponseAPDU represents a Response Application Protocol Data Unit received from the smart card in response to a previous CommandAPDU. A response APDU consists of an optional body and a mandatory trailer.
    Author:
    Dirk Husemann (hud@zurich.ibm.com), Peter Trommler (trp@zurich.ibm.com), Reto Hermann (rhe@zurich.ibm.com), Mike Wendler (mwendler@de.ibm.com)
    • Constructor Detail

      • ResponseAPDU

        public ResponseAPDU​(byte[] apdu)
        Creates a new object of this type and initializes it with the given apdu buffer. The internal buffer's length is set to the length of the buffer passed.
        Parameters:
        apdu - the byte array to be used for holding the APDU
        Throws:
        OpencardRuntimeException - thrown when apdu is invalid
        See Also:
        APDU.getLength()
      • ResponseAPDU

        public ResponseAPDU​(int size)
        Constructs an object of this type with the given buffer size. A new buffer with the given size is allocated. The length of the internally buffered APDU is set to 0.
        Parameters:
        size - the size of the buffer to create
        Throws:
        OpencardRuntimeException - thrown when apdu is invalid
        See Also:
        APDU.getLength()
    • Method Detail

      • setQueued

        public void setQueued​(boolean queued)
      • isQueued

        public boolean isQueued()
      • data

        public byte[] data()
        Gets the data fields of the APDU.
        Returns:
        a byte array containing the APDU data field
      • sw

        public final int sw()
        Gets the value of SW1 and SW2 as a short integer. It is computed as: (((sw1<<8)&0xFF00) | (sw2&0xFF)).
        Returns:
        The value (((sw1<<8)&0xFF00) | (sw2&0xFF)) as integer.
      • sw1

        public final byte sw1()
        Gets the value of SW1 as a byte.
        Returns:
        The value of SW1
      • sw2

        public final byte sw2()
        Gets the value of SW1 as a byte.
        Returns:
        The value of SW2