com.licel.jcardsim.samples.JavaPurseCrypto
Class ParametersFile

java.lang.Object
  extended by com.licel.jcardsim.samples.JavaPurseCrypto.ParametersFile

public class ParametersFile
extends Object

This is the class for all linear variable-length record files, and the base class for linear variable-fixed and cyclic record files.


Constructor Summary
ParametersFile(byte maxNumRecords)
          Constructor.
 
Method Summary
 void addRecord(byte[] record)
          Add (append) a new record to the file.
 byte findRecord(byte firstByte)
          Find the record.
 byte getNumRecords()
          Get the actual number of records in this file.
 byte[] getRecord(byte recordNum)
          Get the record byte array for the specified record number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParametersFile

public ParametersFile(byte maxNumRecords)
Constructor.

Parameters:
maxNumRecords - the maximum number of records in this file
Method Detail

getNumRecords

public byte getNumRecords()
Get the actual number of records in this file.

Returns:
numRecords

addRecord

public void addRecord(byte[] record)
               throws ISOException
Add (append) a new record to the file. Note that the record reference is stored in the file object. A copy of the record byte array is not made.

Parameters:
record - the record byte array
Throws:
ISOException - if the file is full.
  • ISOException.reason = ISO7816.SW_FILE_FULL

getRecord

public byte[] getRecord(byte recordNum)
Get the record byte array for the specified record number. This is a reference to the actual file data, not a copy of the file data. Records are in the order that they were added to the file. Record number is in the range from 1 to the number of records in the file

Parameters:
recordNum - the index (first record = 1) of the record.
Returns:
record or null if the record is not found

findRecord

public byte findRecord(byte firstByte)
Find the record.

Parameters:
firstByte - if non-0, the record's first byte must match this value; if 0, any value of the record's first byte matches.
Returns:
the record number, or 0 if the record is not found