Package com.sun.javacard.apduio
Class CadDevice
- java.lang.Object
-
- com.sun.javacard.apduio.CadDevice
-
- Direct Known Subclasses:
CadPCSCClient
,CadT0
,CadT1
public abstract class CadDevice extends java.lang.Object
Factory class producing CardClientInterface instances (connections to a card)
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.ResourceBundle
_messages
Properties file with messagesprotected boolean
debug
Internal debug flag.protected byte
deviceProtocol
The currentry used protocolprotected java.io.InputStream
in
The input stream which data is read from.protected java.io.OutputStream
out
The output stream to which data is written.static byte
PROTOCOL_PCSC
PC/SC constantstatic byte
PROTOCOL_T0
Protocol constantstatic byte
PROTOCOL_T1
Protocol constantstatic byte
PROTOCOL_TCL
Protocol constant
-
Constructor Summary
Constructors Modifier Constructor Description protected
CadDevice(byte devProtocolType)
PCSC streams is using this form of constructor and are not applicableprotected
CadDevice(byte devProtocolType, java.io.InputStream in, java.io.OutputStream out)
T=0, T=1 implementations is using this form of constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Flush and close the input and output streams.static CadClientInterface
getCadClientInstance(byte protocolType, java.io.InputStream in, java.io.OutputStream out)
A factory methodbyte
getDeviceProtocol()
Get the value of the protocol bytestatic CadClientInterface
getPCSCClientInstance(int readerNumber)
A factory method for connecting to a PCSC card readed
-
-
-
Field Detail
-
_messages
protected static java.util.ResourceBundle _messages
Properties file with messages
-
in
protected java.io.InputStream in
The input stream which data is read from. This field is used to store the reference to the input stream which an instance of the Cad class reads from.
-
out
protected java.io.OutputStream out
The output stream to which data is written. This field is used to store the reference to the output stream which an instance of the Cad class writes to.
-
debug
protected boolean debug
Internal debug flag. Set the system property apduIODebug to 0x01 to activate transport level debugging.
-
PROTOCOL_T0
public static final byte PROTOCOL_T0
Protocol constant- See Also:
- Constant Field Values
-
PROTOCOL_T1
public static final byte PROTOCOL_T1
Protocol constant- See Also:
- Constant Field Values
-
PROTOCOL_TCL
public static final byte PROTOCOL_TCL
Protocol constant- See Also:
- Constant Field Values
-
PROTOCOL_PCSC
public static final byte PROTOCOL_PCSC
PC/SC constant- See Also:
- Constant Field Values
-
deviceProtocol
protected byte deviceProtocol
The currentry used protocol
-
-
Constructor Detail
-
CadDevice
protected CadDevice(byte devProtocolType, java.io.InputStream in, java.io.OutputStream out)
T=0, T=1 implementations is using this form of constructor- Parameters:
devProtocolType
- Procol constant: T1 or T1in
- Input stream from a simulator or a TLP224 card readerout
- Output stream to a simulator or a TLP224 card reader
-
CadDevice
protected CadDevice(byte devProtocolType)
PCSC streams is using this form of constructor and are not applicable- Parameters:
devProtocolType
- Protocol type (PCSC)
-
-
Method Detail
-
getDeviceProtocol
public byte getDeviceProtocol()
Get the value of the protocol byte- Returns:
- the value of the protocol byte
-
getCadClientInstance
public static CadClientInterface getCadClientInstance(byte protocolType, java.io.InputStream in, java.io.OutputStream out)
A factory method- Parameters:
protocolType
- Protocol constantin
- Input stream from a simulatorout
- Output stream to a simulator- Returns:
- New instance of a card connection
-
getPCSCClientInstance
public static CadClientInterface getPCSCClientInstance(int readerNumber)
A factory method for connecting to a PCSC card readed- Parameters:
readerNumber
- PC/SC reader number (0, 1, 2...)- Returns:
- Connection to the reader
-
close
public void close() throws java.io.IOException
Flush and close the input and output streams.- Throws:
java.io.IOException
- If there is an error closing or flushing the input or output streams.
-
-