com.sun.javacard.apduio
Class CadDevice

java.lang.Object
  extended by com.sun.javacard.apduio.CadDevice

public abstract class CadDevice
extends java.lang.Object

Factory class producing CardClientInterface instances (connections to a card)


Field Summary
protected static java.util.ResourceBundle _messages
          Properties file with messages
protected  boolean debug
          Internal debug flag.
protected  byte deviceProtocol
          The currentry used protocol
protected  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 constant
static byte PROTOCOL_T0
          Protocol constant
static byte PROTOCOL_T1
          Protocol constant
static byte PROTOCOL_TCL
          Protocol constant
 
Constructor Summary
protected CadDevice(byte devProtocolType)
          this form of constructor is used by PCSC streams are not applicable
protected CadDevice(byte devProtocolType, java.io.InputStream in, java.io.OutputStream out)
          this form of constructor is used by T=0, T=1 implementations
 
Method Summary
 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 method
 byte getDeviceProtocol()
          Get the value of the protocol byte
static CadClientInterface getPCSCClientInstance(int readerNumber)
          A factory method for connecting to a PCSC card readed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)
this form of constructor is used by T=0, T=1 implementations

Parameters:
devProtocolType - Procol constant: T1 or T1
in - Input stream from a simulator or a TLP224 card reader
out - Output stream to a simulator or a TLP224 card reader

CadDevice

protected CadDevice(byte devProtocolType)
this form of constructor is used by PCSC streams 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 constant
in - Input stream from a simulator
out - 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.