Class CardTerminal
public abstract class CardTerminal extends Object
Note that physical card readers with slots for multiple cards are represented by one CardTerminal object per such slot.
- Since:
- 1.6
- See Also:
Constructor Summary
| Modifier | Constructor | Description |
|---|---|---|
protected |
Constructs a new CardTerminal object. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
abstract Card |
connect |
Establishes a connection to the card. |
abstract String |
getName() |
Returns the unique name of this terminal. |
abstract boolean |
isCardPresent() |
Returns whether a card is present in this terminal. |
abstract boolean |
waitForCardAbsent |
Waits until a card is absent in this terminal or the timeout expires. |
abstract boolean |
waitForCardPresent |
Waits until a card is present in this terminal or the timeout expires. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
String |
toString() |
Returns a string representation of the object. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Constructor Details
CardTerminal
protected CardTerminal()
This constructor is called by subclasses only. Application should call list() or getTerminal() to obtain a CardTerminal object.
Method Details
getName
public abstract String getName()
- Returns:
- the unique name of this terminal.
connect
public abstract Card connect(String protocol) throws CardException
- Parameters:
-
protocol- the protocol to use ("T=0", "T=1", or "T=CL"), or "*" to connect using any available protocol. - Returns:
- the card the connection has been established with
- Throws:
-
NullPointerException- if protocol is null -
IllegalArgumentException- if protocol is an invalid protocol specification -
CardNotPresentException- if no card is present in this terminal -
CardException- if a connection could not be established using the specified protocol or if a connection has previously been established using a different protocol -
SecurityException- if a SecurityManager exists and the caller does not have the required permission
isCardPresent
public abstract boolean isCardPresent() throws CardException
- Returns:
- whether a card is present in this terminal.
- Throws:
-
CardException- if the status could not be determined
waitForCardPresent
public abstract boolean waitForCardPresent(long timeout) throws CardException
If a card is present in this terminal when this method is called, it returns immediately.
- Parameters:
-
timeout- if positive, block for up totimeoutmilliseconds; if zero, block indefinitely; must not be negative - Returns:
- false if the method returns due to an expired timeout, true otherwise.
- Throws:
-
IllegalArgumentException- if timeout is negative -
CardException- if the operation failed
waitForCardAbsent
public abstract boolean waitForCardAbsent(long timeout) throws CardException
If no card is present in this terminal when this method is called, it returns immediately.
- Parameters:
-
timeout- if positive, block for up totimeoutmilliseconds; if zero, block indefinitely; must not be negative - Returns:
- false if the method returns due to an expired timeout, true otherwise.
- Throws:
-
IllegalArgumentException- if timeout is negative -
CardException- if the operation failed
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.