Class Card
java.lang.Object
javax.smartcardio.Card
A Smart Card with which a connection has been established. Card objects
are obtained by calling
CardTerminal.connect().- Since:
- 1.6
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidRequests exclusive access to this card.abstract voiddisconnect(boolean reset) Disconnects the connection with this card.abstract voidReleases the exclusive access previously established usingbeginExclusive.abstract ATRgetATR()Returns the ATR of this card.abstract CardChannelReturns the CardChannel for the basic logical channel.abstract StringReturns the protocol in use for this card.abstract CardChannelOpens a new logical channel to the card and returns it.abstract byte[]transmitControlCommand(int controlCode, byte[] command) Transmits a control command to the terminal device.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
Card
protected Card()Constructs a new Card object.This constructor is called by subclasses only. Application should call the CardTerminal.connect() method to obtain a Card object.
-
-
Method Details
-
getATR
-
getProtocol
Returns the protocol in use for this card.- Returns:
- the protocol in use for this card, for example "T=0" or "T=1"
-
getBasicChannel
Returns the CardChannel for the basic logical channel. The basic logical channel has a channel number of 0.- Returns:
- the CardChannel for the basic logical channel
- Throws:
SecurityException- if a SecurityManager exists and the caller does not have the required permissionIllegalStateException- if this card object has been disposed of via the disconnect() method
-
openLogicalChannel
Opens a new logical channel to the card and returns it. The channel is opened by issuing aMANAGE CHANNELcommand that should use the format[00 70 00 00 01].- Returns:
- the logical channel which has been opened
- Throws:
SecurityException- if a SecurityManager exists and the caller does not have the required permissionCardException- is a new logical channel could not be openedIllegalStateException- if this card object has been disposed of via the disconnect() method
-
beginExclusive
Requests exclusive access to this card.Once a thread has invoked
beginExclusive, only this thread is allowed to communicate with this card until it callsendExclusive. Other threads attempting communication will receive a CardException.Applications have to ensure that exclusive access is correctly released. This can be achieved by executing the
beginExclusive()andendExclusivecalls in atry ... finallyblock.- Throws:
SecurityException- if a SecurityManager exists and the caller does not have the required permissionCardException- if exclusive access has already been set or if exclusive access could not be establishedIllegalStateException- if this card object has been disposed of via the disconnect() method
-
endExclusive
Releases the exclusive access previously established usingbeginExclusive.- Throws:
SecurityException- if a SecurityManager exists and the caller does not have the required permissionIllegalStateException- if the active Thread does not currently have exclusive access to this card or if this card object has been disposed of via the disconnect() methodCardException- if the operation failed
-
transmitControlCommand
Transmits a control command to the terminal device.This can be used to, for example, control terminal functions like a built-in PIN pad or biometrics.
- Parameters:
controlCode- the control code of the commandcommand- the command data- Returns:
- the response from the terminal device
- Throws:
SecurityException- if a SecurityManager exists and the caller does not have the required permissionNullPointerException- if command is nullCardException- if the card operation failedIllegalStateException- if this card object has been disposed of via the disconnect() method
-
disconnect
Disconnects the connection with this card. After this method returns, calling methods on this object or in CardChannels associated with this object that require interaction with the card will raise an IllegalStateException.- Parameters:
reset- whether to reset the card after disconnecting.- Throws:
CardException- if the card operation failedSecurityException- if a SecurityManager exists and the caller does not have the required permission
-