/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.smartcardio;
/**
* body and a two byte trailer.
* This class does not attempt to verify that the APDU encodes a semantically
* valid response.
*
* <p>Instances of this class are immutable. Where data is passed in or out
* via byte arrays, defensive cloning is performed.
*
* @see CommandAPDU
* @see CardChannel#transmit CardChannel.transmit
*
* @since 1.6
* @author Andreas Sterbenz
* @author JSR 268 Expert Group
*/
/** @serial */
private byte[] apdu;
/**
* Constructs a ResponseAPDU from a byte array containing the complete
* APDU contents (conditional body and trailed).
*
* <p>Note that the byte array is cloned to protect against subsequent
* modification.
*
* @param apdu the complete response APDU
*
* @throws NullPointerException if apdu is null
* @throws IllegalArgumentException if apdu.length is less than 2
*/
}
throw new IllegalArgumentException("apdu must be at least 2 bytes long");
}
}
/**
* Returns the number of data bytes in the response body (Nr) or 0 if this
* APDU has no body. This call is equivalent to
* <code>getData().length</code>.
*
* @return the number of data bytes in the response body or 0 if this APDU
* has no body.
*/
public int getNr() {
}
/**
* Returns a copy of the data bytes in the response body. If this APDU as
* no body, this method returns a byte array with a length of zero.
*
* @return a copy of the data bytes in the response body or the empty
* byte array if this APDU has no body.
*/
public byte[] getData() {
return data;
}
/**
* Returns the value of the status byte SW1 as a value between 0 and 255.
*
* @return the value of the status byte SW1 as a value between 0 and 255.
*/
public int getSW1() {
}
/**
* Returns the value of the status byte SW2 as a value between 0 and 255.
*
* @return the value of the status byte SW2 as a value between 0 and 255.
*/
public int getSW2() {
}
/**
* Returns the value of the status bytes SW1 and SW2 as a single
* status word SW.
* It is defined as
* <code>(getSW1() << 8) | getSW2()</code>.
*
* @return the value of the status word SW.
*/
public int getSW() {
}
/**
* Returns a copy of the bytes in this APDU.
*
* @return a copy of the bytes in this APDU.
*/
public byte[] getBytes() {
}
/**
* Returns a string representation of this response APDU.
*
* @return a String representation of this response APDU.
*/
}
/**
* Compares the specified object with this response APDU for equality.
* Returns true if the given object is also a ResponseAPDU and its bytes are
* identical to the bytes in this ResponseAPDU.
*
* @param obj the object to be compared for equality with this response APDU
* @return true if the specified object is equal to this response APDU
*/
if (this == obj) {
return true;
}
if (obj instanceof ResponseAPDU == false) {
return false;
}
}
/**
* Returns the hash code value for this response APDU.
*
* @return the hash code value for this response APDU.
*/
public int hashCode() {
}
}
}