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

pack-priv final Class CardImpl

extends Card
Class Inheritance
Imports
jdk.internal.util.OperatingSystem, javax.smartcardio.*

Card implementation.
Author
Andreas Sterbenz
Since
1.6

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private final ATR
private final ChannelImpl
pack-priv final long
private static byte[]
private volatile Thread
pack-priv final int
private volatile CardImpl.State
private final TerminalImpl

Constructor Summary

AccessConstructor and Description
pack-priv
CardImpl(TerminalImpl terminal, String protocol)

Method Summary

Modifier and TypeMethod and Description
public synchronized void
beginExclusive()

Implements abstract javax.smartcardio.Card.beginExclusive.

Requests exclusive access to this card.

pack-priv void
private void
pack-priv void
public void
disconnect(boolean reset)

Implements abstract javax.smartcardio.Card.disconnect.

Disconnects the connection with this card.

public synchronized void
endExclusive()

Implements abstract javax.smartcardio.Card.endExclusive.

Releases the exclusive access previously established using beginExclusive.

protected void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

public ATR
getATR()

Implements abstract javax.smartcardio.Card.getATR.

Returns the ATR of this card.

public CardChannel
getBasicChannel()

Implements abstract javax.smartcardio.Card.getBasicChannel.

Returns the CardChannel for the basic logical channel.

public String
getProtocol()

Implements abstract javax.smartcardio.Card.getProtocol.

Returns the protocol in use for this card.

private static int
getSW(byte[] b)

pack-priv void
pack-priv boolean
public CardChannel
openLogicalChannel()

Implements abstract javax.smartcardio.Card.openLogicalChannel.

Opens a new logical channel to the card and returns it.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public byte[]
transmitControlCommand(int controlCode, byte[] command)

Implements abstract javax.smartcardio.Card.transmitControlCommand.

Transmits a control command to the terminal device.

Field Detail

atrback to summary
private final ATR atr
basicChannelback to summary
private final ChannelImpl basicChannel
cardIdback to summary
pack-priv final long cardId
commandOpenChannelback to summary
private static byte[] commandOpenChannel
exclusiveThreadback to summary
private volatile Thread exclusiveThread
protocolback to summary
pack-priv final int protocol
stateback to summary
private volatile CardImpl.State state
terminalback to summary
private final TerminalImpl terminal

Constructor Detail

CardImplback to summary
pack-priv CardImpl(TerminalImpl terminal, String protocol) throws PCSCException

Method Detail

beginExclusiveback to summary
public synchronized void beginExclusive() throws CardException

Implements abstract javax.smartcardio.Card.beginExclusive.

Doc from javax.smartcardio.Card.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 calls endExclusive. 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() and endExclusive calls in a try ... finally block.

Exceptions
CardException:
if exclusive access has already been set or if exclusive access could not be established
checkExclusiveback to summary
pack-priv void checkExclusive() throws CardException
checkSecurityback to summary
private void checkSecurity(String action)
checkStateback to summary
pack-priv void checkState()
disconnectback to summary
public void disconnect(boolean reset) throws CardException

Implements abstract javax.smartcardio.Card.disconnect.

Doc from javax.smartcardio.Card.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.

Exceptions
CardException:
if the card operation failed
endExclusiveback to summary
public synchronized void endExclusive() throws CardException

Implements abstract javax.smartcardio.Card.endExclusive.

Doc from javax.smartcardio.Card.endExclusive.

Releases the exclusive access previously established using beginExclusive.

Exceptions
CardException:
if the operation failed
finalizeback to summary
protected void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Doc from java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

When running in a Java virtual machine in which finalization has been disabled or removed, the garbage collector will never call finalize(). In a Java virtual machine in which finalization is enabled, the garbage collector might call finalize only after an indefinite delay.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Annotations
@SuppressWarnings:removal
Exceptions
Throwable:
the Exception raised by this method
getATRback to summary
public ATR getATR()

Implements abstract javax.smartcardio.Card.getATR.

Doc from javax.smartcardio.Card.getATR.

Returns the ATR of this card.

getBasicChannelback to summary
public CardChannel getBasicChannel()

Implements abstract javax.smartcardio.Card.getBasicChannel.

Doc from javax.smartcardio.Card.getBasicChannel.

Returns the CardChannel for the basic logical channel. The basic logical channel has a channel number of 0.

getProtocolback to summary
public String getProtocol()

Implements abstract javax.smartcardio.Card.getProtocol.

Doc from javax.smartcardio.Card.getProtocol.

Returns the protocol in use for this card.

getSWback to summary
private static int getSW(byte[] b)
handleErrorback to summary
pack-priv void handleError(PCSCException e)
isValidback to summary
pack-priv boolean isValid()
openLogicalChannelback to summary
public CardChannel openLogicalChannel() throws CardException

Implements abstract javax.smartcardio.Card.openLogicalChannel.

Doc from javax.smartcardio.Card.openLogicalChannel.

Opens a new logical channel to the card and returns it. The channel is opened by issuing a MANAGE CHANNEL command that should use the format [00 70 00 00 01].

Exceptions
CardException:
is a new logical channel could not be opened
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

transmitControlCommandback to summary
public byte[] transmitControlCommand(int controlCode, byte[] command) throws CardException

Implements abstract javax.smartcardio.Card.transmitControlCommand.

Doc from javax.smartcardio.Card.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.

Exceptions
CardException:
if the card operation failed
sun.security.smartcardio back to summary

private final Enum CardImpl.State

extends Enum<CardImpl.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final CardImpl.State
public static final CardImpl.State
public static final CardImpl.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CardImpl.State
public static CardImpl.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DISCONNECTEDback to summary
public static final CardImpl.State DISCONNECTED
OKback to summary
public static final CardImpl.State OK
REMOVEDback to summary
public static final CardImpl.State REMOVED

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static CardImpl.State valueOf(String name)
valuesback to summary
public static CardImpl.State[] values()