|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopencard.opt.iso.fs.CardRandomAccess
opencard.opt.iso.fs.CardRandomRecordAccess
public class CardRandomRecordAccess
CardRandomRecordAccess provides record-oriented, random access to structured smart card files. This class supports only linear files of either fixed or variable record size. There is no random access to cyclic files. To access transparent files, use CardRandomByteAccess CardRandomRecordAccess is loosely modeled on java.io.RandomAccessFile.
RandomAccessFile
,
CardRandomByteAccess
Field Summary |
---|
Fields inherited from class opencard.opt.iso.fs.CardRandomAccess |
---|
file, filePointer, fileSystem, open, writeAccess |
Constructor Summary | |
---|---|
CardRandomRecordAccess(CardFile scFile)
Instantiates a CardRandomRecordAccess. |
|
CardRandomRecordAccess(CardFile scFile,
java.lang.String accessMode)
Instantiates a CardRandomRecordAccess object. |
Method Summary | |
---|---|
long |
getFilePointer()
Returns the current location of the file pointer. |
int |
read(CardRecord[] r)
Reads data into an array of CardRecords. |
int |
read(CardRecord[] r,
int off,
int len)
Reads a sub array as a sequence of CardRecords. |
CardRecord |
readRecord()
Reads a data record. |
void |
seek(long pos)
Sets the file pointer to the specified absolute position. |
int |
skip(int n)
Skips the number of records specified. |
void |
write(CardRecord r)
Writes a record. |
void |
write(CardRecord[] r)
Writes an array of records. |
void |
write(CardRecord[] r,
int off,
int len)
Writes a slice of a CardRecord array. |
Methods inherited from class opencard.opt.iso.fs.CardRandomAccess |
---|
close, finalize, open |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CardRandomRecordAccess(CardFile scFile) throws CardTerminalException, java.io.IOException
scFile
- The CardFile object that represents the file on the
smart card.
CardTerminalException
- Thrown when the smart card has been removed.
java.io.IOException
- Thrown for all other I/O exceptions.public CardRandomRecordAccess(CardFile scFile, java.lang.String accessMode) throws CardTerminalException, java.io.IOException
scFile
- The CardFile object that represents the file on the
smart card.accessMode
- Specifies whether the card is accessed for read "r" or
read and write "rw".
CardTerminalException
- Thrown when the smart card has been removed.
java.io.IOException
- Thrown for all other I/O exceptions.Method Detail |
---|
public long getFilePointer() throws java.io.IOException, CardTerminalException
java.io.IOException
- Thrown if an I/O error has occurred.
CardTerminalException
- Thrown when the smart card has been removed.
java.io.IOException
- Thrown for all other I/O exceptions.public void seek(long pos) throws java.io.EOFException, CardTerminalException
pos
- The absolute position
java.io.EOFException
- Thrown if the seeked position is behind the end of the file.
For linear variable files, this cannot be checked. An error
will occur on the subsequent read or write operation.
CardTerminalException
- Thrown when the smart card has been removed.public int skip(int n) throws java.io.EOFException, CardTerminalException
n
- The number of records to skip
java.io.EOFException
- EOF reached before all records have been skipped.
This cannot be checked for linear variable files.
CardTerminalException
- Thrown when the smart card has been removed.public CardRecord readRecord() throws java.io.IOException, CardTerminalException
java.io.IOException
- Thrown if an I/O error has occurred.
CardTerminalException
- Thrown when the smart card has been removed.public int read(CardRecord[] r) throws java.io.IOException, CardTerminalException
r
- The CardRecord array to store the records in.
java.io.IOException
- Thrown if an I/O error has occurred.
CardTerminalException
- Thrown when the smart card has been removed.public int read(CardRecord[] r, int off, int len) throws java.io.IOException, CardTerminalException
r
- The data to be readoff
- The start offset in the datalen
- The number of records to be read
java.io.IOException
- Thrown if an I/O error has occurred.
CardTerminalException
- Thrown when the smart card has been removed.public void write(CardRecord r) throws java.io.IOException, CardTerminalException
r
- The record to be written
java.io.IOException
- Thrown if an I/O error has occurred.
CardTerminalException
- Thrown when the smart card has been removed.public void write(CardRecord[] r) throws java.io.IOException, CardTerminalException
r
- The records to be written
java.io.IOException
- Thrown if an I/O error has occurred.
CardTerminalException
- Thrown when the smart card has been removed.public void write(CardRecord[] r, int off, int len) throws java.io.IOException, CardTerminalException
r
- The data to be writtenoff
- The start offset in the datalen
- The number of records to be written
java.io.IOException
- Thrown if an I/O error has occurred.
CardTerminalException
- Thrown when the smart card has been removed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |