APIdia Launch Partner
Top Description Constructors Methods
javax.smartcardio

public abstract Class CardTerminal

extends Object
Class Inheritance
Known Direct Subclasses
sun.security.smartcardio.TerminalImpl
Imports
java.util.*

A Smart Card terminal, sometimes referred to as a Smart Card Reader. A CardTerminal object can be obtained by calling CardTerminals#list or CardTerminals.getTerminal().

Note that physical card readers with slots for multiple cards are represented by one CardTerminal object per such slot.

Authors
Andreas Sterbenz, JSR 268 Expert Group
Since
1.6
See Also
CardTerminals, TerminalFactory

Constructor Summary

AccessConstructor and Description
protected
CardTerminal()

Constructs a new CardTerminal object.

Method Summary

Modifier and TypeMethod and Description
public abstract Card

Returns:

the card the connection has been established with
connect
(String
the protocol to use ("T=0", "T=1", or "T=CL"), or "*" to connect using any available protocol.
protocol
)

Establishes a connection to the card.

public abstract String

Returns:

the unique name of this terminal.
getName
()

Returns the unique name of this terminal.

public abstract boolean

Returns:

whether a card is present in this terminal.
isCardPresent
()

Returns whether a card is present in this terminal.

public abstract boolean

Returns:

false if the method returns due to an expired timeout, true otherwise.
waitForCardAbsent
(long
if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negative
timeout
)

Waits until a card is absent in this terminal or the timeout expires.

public abstract boolean

Returns:

false if the method returns due to an expired timeout, true otherwise.
waitForCardPresent
(long
if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negative
timeout
)

Waits until a card is present in this terminal or the timeout expires.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CardTerminalback to summary
protected CardTerminal()

Constructs a new CardTerminal object.

This constructor is called by subclasses only. Application should call list() or getTerminal() to obtain a CardTerminal object.

Method Detail

connectback to summary
public abstract Card connect(String protocol) throws CardException

Establishes a connection to the card. If a connection has previously established using the specified protocol, this method returns the same Card object as the previous call.

Parameters
protocol:String

the protocol to use ("T=0", "T=1", or "T=CL"), or "*" to connect using any available protocol.

Returns:Card

the card the connection has been established with

Exceptions
CardException:
if a connection could not be established using the specified protocol or if a connection has previously been established using a different protocol
NullPointerException:
if protocol is null
IllegalArgumentException:
if protocol is an invalid protocol specification
CardNotPresentException:
if no card is present in this terminal
SecurityException:
if a SecurityManager exists and the caller does not have the required permission
getNameback to summary
public abstract String getName()

Returns the unique name of this terminal.

Returns:String

the unique name of this terminal.

isCardPresentback to summary
public abstract boolean isCardPresent() throws CardException

Returns whether a card is present in this terminal.

Returns:boolean

whether a card is present in this terminal.

Exceptions
CardException:
if the status could not be determined
waitForCardAbsentback to summary
public abstract boolean waitForCardAbsent(long timeout) throws CardException

Waits until a card is absent in this terminal or the timeout expires. If the method returns due to an expired timeout, it returns false. Otherwise it return true.

If no card is present in this terminal when this method is called, it returns immediately.

Parameters
timeout:long

if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negative

Returns:boolean

false if the method returns due to an expired timeout, true otherwise.

Exceptions
CardException:
if the operation failed
IllegalArgumentException:
if timeout is negative
waitForCardPresentback to summary
public abstract boolean waitForCardPresent(long timeout) throws CardException

Waits until a card is present in this terminal or the timeout expires. If the method returns due to an expired timeout, it returns false. Otherwise it return true.

If a card is present in this terminal when this method is called, it returns immediately.

Parameters
timeout:long

if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negative

Returns:boolean

false if the method returns due to an expired timeout, true otherwise.

Exceptions
CardException:
if the operation failed
IllegalArgumentException:
if timeout is negative