com.sun.javacard.apduio
Class CadT0
java.lang.Object
com.sun.javacard.apduio.CadDevice
com.sun.javacard.apduio.CadT0
- Direct Known Subclasses:
- CadT0Client
public class CadT0
- extends CadDevice
The CadT0 class manages the encodes and decodes TLP224 transport level
messages between an InputStream and an OutputStream. TLP224 Messages have the
following format: <ACK><LN><MESSAGE><LRC>
where:
<ACK> 0x60, indicating that the previous command or status response
was transmitted without error.
<LN> The length in octets of <MESSAGE>
<MESSAGE> Is the command or response message.
<LRC> Is the exclusive-or of the ACK, LN and MESSAGE octets.
Messages are converted from octets to two hexadecimal ASCII characters. An
ASCII EOT (0x03) character is then appended to the end of the message.
Constructor Summary |
CadT0(java.io.InputStream in,
java.io.OutputStream out)
Create a new instance of the CadT0 class using an InputStream and an
OutputStream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CadT0
public CadT0(java.io.InputStream in,
java.io.OutputStream out)
- Create a new instance of the CadT0 class using an InputStream and an
OutputStream.
- Parameters:
in
- The InputStream to read from.out
- The OutputStream to write to.
receiveTLP224Message
public void receiveTLP224Message(TLP224Message msg)
throws java.io.IOException,
TLP224Exception
- Receive a TLP224 formatted message from the input stream. This method
reads bytes from the input stream until an EOT (0x03) character is
received. The resulting message is decoded and stored in the TL224Message
msg. In the event of a transmission error, this method will send attempt
error recovery by sending a TLP224 NACK message to the sender. Up to 5
retries will be performed.
- Parameters:
msg
- The object to store the received message in.
- Throws:
TLP224Exception
- If an unrecoverable transmission error occurs.
java.io.IOException
- If an error occurs while reading from the input stream.
sendTLP224Message
public void sendTLP224Message(TLP224Message msg)
throws java.io.IOException
- Format a TLP224Message and send to the output stream. This method formats
a TLP224Message into it's ASCII representation and sends the message on
the output stream. After the message is completed, an ASCII EOT character
is then sent to the output stream.
- Throws:
java.io.IOException
Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.