APIdia Launch Partner
Top Description Constructors Methods
javax.smartcardio

public abstract Class Card

extends Object
Class Inheritance
Known Direct Subclasses
sun.security.smartcardio.CardImpl
Imports
java.nio.ByteBuffer

A Smart Card with which a connection has been established. Card objects are obtained by calling CardTerminal.connect().
Authors
Andreas Sterbenz, JSR 268 Expert Group
Since
1.6
See Also
CardTerminal

Constructor Summary

AccessConstructor and Description
protected
Card()

Constructs a new Card object.

Method Summary

Modifier and TypeMethod and Description
public abstract void
beginExclusive()

Requests exclusive access to this card.

public abstract void
disconnect(boolean
whether to reset the card after disconnecting.
reset
)

Disconnects the connection with this card.

public abstract void
endExclusive()

Releases the exclusive access previously established using beginExclusive.

public abstract ATR

Returns:

the ATR of this card.
getATR
()

Returns the ATR of this card.

public abstract CardChannel

Returns:

the CardChannel for the basic logical channel
getBasicChannel
()

Returns the CardChannel for the basic logical channel.

public abstract String

Returns:

the protocol in use for this card, for example "T=0" or "T=1"
getProtocol
()

Returns the protocol in use for this card.

public abstract CardChannel

Returns:

the logical channel which has been opened
openLogicalChannel
()

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

public abstract byte[]

Returns:

the response from the terminal device
transmitControlCommand
(int
the control code of the command
controlCode
,
byte[]
the command data
command
)

Transmits a control command to the terminal device.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Cardback to summary
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 Detail

beginExclusiveback to summary
public abstract void beginExclusive() throws CardException

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
SecurityException:
if a SecurityManager exists and the caller does not have the required permission
IllegalStateException:
if this card object has been disposed of via the disconnect() method
disconnectback to summary
public abstract void disconnect(boolean reset) throws CardException

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:boolean

whether to reset the card after disconnecting.

Exceptions
CardException:
if the card operation failed
SecurityException:
if a SecurityManager exists and the caller does not have the required permission
endExclusiveback to summary
public abstract void endExclusive() throws CardException

Releases the exclusive access previously established using beginExclusive.

Exceptions
CardException:
if the operation failed
SecurityException:
if a SecurityManager exists and the caller does not have the required permission
IllegalStateException:
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() method
getATRback to summary
public abstract ATR getATR()

Returns the ATR of this card.

Returns:ATR

the ATR of this card.

getBasicChannelback to summary
public abstract CardChannel getBasicChannel()

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

Returns:CardChannel

the CardChannel for the basic logical channel

Exceptions
SecurityException:
if a SecurityManager exists and the caller does not have the required permission
IllegalStateException:
if this card object has been disposed of via the disconnect() method
getProtocolback to summary
public abstract String getProtocol()

Returns the protocol in use for this card.

Returns:String

the protocol in use for this card, for example "T=0" or "T=1"

openLogicalChannelback to summary
public abstract CardChannel openLogicalChannel() throws CardException

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].

Returns:CardChannel

the logical channel which has been opened

Exceptions
CardException:
is a new logical channel could not be opened
SecurityException:
if a SecurityManager exists and the caller does not have the required permission
IllegalStateException:
if this card object has been disposed of via the disconnect() method
transmitControlCommandback to summary
public abstract byte[] transmitControlCommand(int controlCode, byte[] command) throws CardException

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:int

the control code of the command

command:byte[]

the command data

Returns:byte[]

the response from the terminal device

Exceptions
CardException:
if the card operation failed
SecurityException:
if a SecurityManager exists and the caller does not have the required permission
NullPointerException:
if command is null
IllegalStateException:
if this card object has been disposed of via the disconnect() method