Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## opencard.core.terminal
Class ResponseAPDU

    java.lang.Object
      |
      +--opencard.core.terminal.APDU
            |
            +--opencard.core.terminal.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.

Fields inherited from class opencard.core.terminal.APDU
`apdu_buffer, apdu_length`

Constructor Summary
`ResponseAPDU(byte[] apdu)` Creates a new object of this type and initializes it with the given apdu buffer.
`ResponseAPDU(int size)` Constructs an object of this type with the given buffer size.

Method Summary
`byte[]` | `data()` Gets the data fields of the APDU.
`int` | `sw()` Gets the value of `SW1` and `SW2` as a short integer.
`byte` | `sw1()` Gets the value of `SW1` as a byte.
`byte` | `sw2()` Gets the value of `SW1` as a byte.

Methods inherited from class opencard.core.terminal.APDU
`append, append, getBuffer, getByte, getBytes, getLength, setByte, setLength, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

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:
    `buffer` - 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

### 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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD