APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.smartcardio

pack-priv final Class PCSCTerminals

extends CardTerminals
Class Inheritance
Imports
java.util.*, java.lang.ref.*, javax.smartcardio.*

TerminalFactorySpi implementation class.
Author
Andreas Sterbenz
Since
1.6

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static long
private Map<String, PCSCTerminals.ReaderState>
private static final Map<String, Reference<TerminalImpl>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static synchronized TerminalImpl
pack-priv static synchronized void
public synchronized List<CardTerminal>
list(CardTerminals.State state)

Implements abstract javax.smartcardio.CardTerminals.list.

Returns an unmodifiable list of all terminals matching the specified state.

pack-priv static List<CardTerminal>
waitForCards(List<? extends CardTerminal> terminals, long timeout, boolean wantPresent)

public synchronized boolean
waitForChange(long timeout)

Implements abstract javax.smartcardio.CardTerminals.waitForChange.

Waits for card insertion or removal in any of the terminals of this object or until the timeout expires.

Inherited from javax.smartcardio.CardTerminals:
getTerminallistwaitForChange

Field Detail

contextIdback to summary
private static long contextId
stateMapback to summary
private Map<String, PCSCTerminals.ReaderState> stateMap
terminalsback to summary
private static final Map<String, Reference<TerminalImpl>> terminals

Constructor Detail

PCSCTerminalsback to summary
pack-priv PCSCTerminals()

Method Detail

implGetTerminalback to summary
private static synchronized TerminalImpl implGetTerminal(String name)
initContextback to summary
pack-priv static synchronized void initContext() throws PCSCException
listback to summary
public synchronized List<CardTerminal> list(CardTerminals.State state) throws CardException

Implements abstract javax.smartcardio.CardTerminals.list.

Doc from javax.smartcardio.CardTerminals.list.

Returns an unmodifiable list of all terminals matching the specified state.

If state is State.ALL, this method returns all CardTerminals encapsulated by this object. If state is State.CARD_PRESENT or State.CARD_ABSENT, it returns all CardTerminals where a card is currently present or absent, respectively.

If state is State.CARD_INSERTION or State.CARD_REMOVAL, it returns all CardTerminals for which an insertion (or removal, respectively) was detected during the last call to waitForChange. If waitForChange() has not been called on this object, CARD_INSERTION is equivalent to CARD_PRESENT and CARD_REMOVAL is equivalent to CARD_ABSENT. For an example of the use of CARD_INSERTION, see waitForChange.

Exceptions
CardException:
if the card operation failed
waitForCardsback to summary
pack-priv static List<CardTerminal> waitForCards(List<? extends CardTerminal> terminals, long timeout, boolean wantPresent) throws CardException
waitForChangeback to summary
public synchronized boolean waitForChange(long timeout) throws CardException

Implements abstract javax.smartcardio.CardTerminals.waitForChange.

Doc from javax.smartcardio.CardTerminals.waitForChange.

Waits for card insertion or removal in any of the terminals of this object or until the timeout expires.

This method examines each CardTerminal of this object. If a card was inserted into or removed from a CardTerminal since the previous call to waitForChange(), it returns immediately. Otherwise, or if this is the first call to waitForChange() on this object, it blocks until a card is inserted into or removed from a CardTerminal.

If timeout is greater than 0, the method returns after timeout milliseconds even if there is no change in state. In that case, this method returns false; otherwise it returns true.

This method is often used in a loop in combination with list(State.CARD_INSERTION), for example:

 TerminalFactory factory = ...;
 CardTerminals terminals = factory.terminals();
 while (true) {
     for (CardTerminal terminal : terminals.list(CARD_INSERTION)) {
         // examine Card in terminal, return if it matches
     }
     terminals.waitForChange();
 }
Exceptions
CardException:
if the card operation failed
sun.security.smartcardio back to summary

private Class PCSCTerminals.ReaderState

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv int
get()

pack-priv boolean
pack-priv boolean
pack-priv static boolean
present(int state)

pack-priv void
update(int newState)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentback to summary
private int current
previousback to summary
private int previous

Constructor Detail

ReaderStateback to summary
pack-priv ReaderState()

Method Detail

getback to summary
pack-priv int get()
isInsertionback to summary
pack-priv boolean isInsertion()
isRemovalback to summary
pack-priv boolean isRemoval()
presentback to summary
pack-priv static boolean present(int state)
updateback to summary
pack-priv void update(int newState)