OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

com.ibm.opencard.isofs
Interface MFCFileAccessImpl

All Known Implementing Classes:
MFC35FileAccessImpl

public abstract interface MFCFileAccessImpl

The interface to a file access card service implementation. A file access service provides read and update access to smartcard files. The implementation of such a service is responsible for creating command APDUs and evaluating the smartcard's response APDUs.

Version:
$Id: MFCFileAccessImpl.java,v 1.1 1999/12/02 16:06:04 damke Exp $

Method Summary
 void appendRecord(MFCCardChannel channel, byte[] data)
          Appends data to a structured file.
 byte[] decreaseValue(MFCCardChannel channel, int delta)
          Decreases the value of a record in a structured file.
 byte[] increaseValue(MFCCardChannel channel, int delta)
          Increases the value of a record in a structured file.
 byte[] readBinary(MFCCardChannel channel, int offset, int length)
          Reads some bytes from a transparent file.
 byte[] readRecord(MFCCardChannel channel, int record)
          Reads a record from a structured file.
 byte[][] readRecords(MFCCardChannel channel, int number)
          Reads the first records from a structured file.
 void writeBinary(MFCCardChannel channel, int foffset, byte[] source, int soffset, int length)
          Writes data to a transparent file.
 void writeRecord(MFCCardChannel channel, int record, byte[] source)
          Writes data to a structured file.
 

Method Detail

readBinary

public byte[] readBinary(MFCCardChannel channel,
                         int offset,
                         int length)
                  throws CardServiceException,
                         CardTerminalException
Reads some bytes from a transparent file. The transparent file has to be selected.
Parameters:
channel - where to contact the smartcard
offset - index of first byte to read
length - number of bytes to read, 0 for unspecified
Returns:
array holding the bytes read
Throws:
CardServiceException - if the service encountered an error
CardTerminalException - if the terminal encountered an error

readRecord

public byte[] readRecord(MFCCardChannel channel,
                         int record)
                  throws CardServiceException,
                         CardTerminalException
Reads a record from a structured file. The structured file has to be selected.
Parameters:
channel - how to contact the smartcard
record - index of the record to read (0 for first record)
Returns:
byte array holding the data read
Throws:
CardServiceException - if the service encountered an error
CardTerminalException - if the terminal encountered an error

readRecords

public byte[][] readRecords(MFCCardChannel channel,
                            int number)
                     throws CardServiceException,
                            CardTerminalException
Reads the first records from a structured file. The structured file has to be selected.
Parameters:
channel - how to contact the smartcard
number - number of records to read, 0 for all
Returns:
an array of arrays holding the data read
Throws:
CardServiceException - if the service encountered an error
CardTerminalException - if the terminal encountered an error

writeBinary

public void writeBinary(MFCCardChannel channel,
                        int foffset,
                        byte[] source,
                        int soffset,
                        int length)
                 throws CardServiceException,
                        CardTerminalException
Writes data to a transparent file. The transparent file has to be selected.
Parameters:
channel - how to contact the smartcard
foffset - file index of first byte to write to
source - the data to write
soffset - array index of first byte to write
length - number of bytes to write
Throws:
CardServiceException - if the service encountered an error
CardTerminalException - if the terminal encountered an error

writeRecord

public void writeRecord(MFCCardChannel channel,
                        int record,
                        byte[] source)
                 throws CardServiceException,
                        CardTerminalException
Writes data to a structured file. The structured file has to be selected.
Parameters:
channel - how to contact the smartcard
record - number of the record to write (0 for first record)
source - the data to write in the record
Throws:
CardServiceException - if the service encountered an error
CardTerminalException - if the terminal encountered an error

appendRecord

public void appendRecord(MFCCardChannel channel,
                         byte[] data)
                  throws CardServiceException,
                         CardTerminalException
Appends data to a structured file. The structured file has to be selected. Appending is supported for cyclic and linear variable files.
MFC smartcards prior to 4.1 do not support the APPEND RECORD command. See MFC35FileAccessImpl.appendRecord to learn how this situation is dealt with.
Parameters:
channel - how to contact the smartcard
data - the data to append
Throws:
CardServiceException - if the service encountered an error
CardTerminalException - if the terminal encountered an error
See Also:
MFC35FileAccessImpl.appendRecord(com.ibm.opencard.service.MFCCardChannel, byte[])

increaseValue

public byte[] increaseValue(MFCCardChannel channel,
                            int delta)
                     throws CardServiceException,
                            CardTerminalException
Increases the value of a record in a structured file. The file has to be selected. The first record within the selected file will be modified. Typically, this operation is used with cyclic files.
Parameters:
channel - the contact to the smartcard
delta - the 3-byte unsigned amount by which to increase
Returns:
the record after the operation.
Throws:
CardServiceException - if the service encountered an error
CardTerminalException - if the terminal encountered an error

decreaseValue

public byte[] decreaseValue(MFCCardChannel channel,
                            int delta)
                     throws CardServiceException,
                            CardTerminalException
Decreases the value of a record in a structured file. The file has to be selected. The first record within the selected file will be modified. Typically, this operation is used with cyclic files.
Parameters:
channel - the contact to the smartcard
delta - the 3-byte unsigned amount by which to decrease
Returns:
the record after the operation
Throws:
CardServiceException - if the service encountered an error
CardTerminalException - if the terminal encountered an error