Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## opencard.opt.iso.fs
Class CardRandomByteAccess

    java.lang.Object
      opencard.opt.iso.fs.CardRandomAccess
          opencard.opt.iso.fs.CardRandomByteAccess

All Implemented Interfaces:
  java.io.DataInput, java.io.DataOutput

    public class CardRandomByteAccess

extends CardRandomAccess
implements java.io.DataOutput, java.io.DataInput

`CardRandomByteAccess` provides a byte-oriented way of accessing a card file (for transparent smart card files).

Version:
  $Id: CardRandomByteAccess.java,v 1.2 1999/11/03 12:37:18 damke Exp $
Author:
  Reto Hermann (rhe@zurich.ibm.com), Peter Trommler (trp@zurich.ibm.com), Dirk Husemann (hud@zurich.ibm.com)
See Also:
  `CardFile`, `RandomAccessFile`, `DataInput`, `DataOutput`

Field Summary

Fields inherited from class opencard.opt.iso.fs.CardRandomAccess
`file, filePointer, fileSystem, open, writeAccess`

Constructor Summary
`CardRandomByteAccess(CardFile scFile)` Instantiate a `CardRandomByteAccess` object.
`CardRandomByteAccess(CardFile scFile, java.lang.String accessMode)` Instantiate a `CardRandomByteAccess` object.

Method Summary
`protected void` | `finalize()` Let the super class free any resources.
`int` | `read()` Reads a byte of data.
`int` | `read(byte[] b)` Reads data into an array of bytes.
`int` | `read(byte[] b, int off, int len)` Reads a sub array as a sequence of bytes.
`boolean` | `readBoolean()` Reads a boolean.
`byte` | `readByte()` Reads a byte.
`char` | `readChar()` Reads a 16 bit char.
`double` | `readDouble()` Reads a 64 bit double.
`float` | `readFloat()` Reads a 32 bit float.
`void` | `readFully(byte[] b)` Reads bytes, blocking until all bytes are read.
`void` | `readFully(byte[] b, int off, int len)` Reads bytes, blocking until all bytes are read.
`int` | `readInt()` Reads a 32 bit int.
`java.lang.String` | `readLine()` Reads a line terminated by a '\n' or EOF.
`long` | `readLong()` Reads a 64 bit long.
`short` | `readShort()` Reads a 16 bit short.
`int` | `readUnsignedByte()` Reads an unsigned 8 bit byte.
`int` | `readUnsignedShort()` Reads 16 bit unsigned short.
`java.lang.String` | `readUTF()` Reads a UTF formatted String.
`int` | `skipBytes(int n)` Skips the number of bytes specified.
`void` | `write(byte[] b)` Writes an array of bytes.
`void` | `write(byte[] b, int off, int len)` Writes a slice of a byte array.
`void` | `write(int b)` Writes a byte of data.
`void` | `writeBoolean(boolean v)` Writes a boolean.
`void` | `writeByte(int v)` Writes a byte.
`void` | `writeBytes(java.lang.String s)` Write a String as a sequence of bytes.
`void` | `writeChar(int v)` Writes a character.
`void` | `writeChars(java.lang.String s)` Writes a String as a sequence of chars.
`void` | `writeDouble(double v)` Writes a double.
`void` | `writeFloat(float v)` Writes a float.
`void` | `writeInt(int v)` Write an integer.
`void` | `writeLong(long v)` Writes a long.
`void` | `writeShort(int v)` Writes a short.
`void` | `writeUTF(java.lang.String str)` Writes a String in UTF format.

Methods inherited from class opencard.opt.iso.fs.CardRandomAccess
`close, open`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CardRandomByteAccess

    public CardRandomByteAccess(CardFile scFile)
                         throws CardTerminalException,
                                java.io.IOException

  Instantiate a `CardRandomByteAccess` object.

  Parameters:
    `scFile` - The `CardFile` object that represents the file on the smart card.
  Throws:
    `CardTerminalException` - Thrown when the smart card has been removed.
    `java.io.IOException` - Thrown for all other I/O exceptions.

### CardRandomByteAccess

    public CardRandomByteAccess(CardFile scFile,
                                java.lang.String accessMode)
                         throws CardTerminalException,
                                java.io.IOException

  Instantiate a `CardRandomByteAccess` object.

  Parameters:
    `scFile` - The `CardFile` object that represents the file on the smart card.
    `accessMode` - Specifies whether the card is accessed for read "r" or read/write "rw".
  Throws:
    `CardTerminalException` - Thrown when the smart card has been removed.
    `java.io.IOException` - Thrown for all other I/O exceptions.

Method Detail

### read

    public int read()
             throws java.io.IOException,
                    CardTerminalException

  Reads a byte of data. This method will block if no input is available.

  Returns:
    The byte read, or `-1` if the end of the file is reached.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### read

    public int read(byte[] b)
             throws java.io.IOException,
                    CardTerminalException

  Reads data into an array of bytes. This method blocks until some input is available.

  Parameters:
    `b` - A buffer to put the data into.
  Returns:
    The actual number of bytes read, `-1` is returned when the end of the file is reached.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException,
                    CardTerminalException

  Reads a sub array as a sequence of bytes.

  Parameters:
    `b` - the buffer to read the data into
    `off` - The start offset in the data buffer
    `len` - The number of bytes to read
  Returns:
    The actual number of bytes read, `-1` is returned when the end of the file is reached.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed. #state specified

### readBoolean

    public boolean readBoolean()
                        throws java.io.IOException,
                               CardTerminalException

  Reads a boolean.

  Specified by:
    `readBoolean` in interface `java.io.DataInput`
  Returns:
    The boolean read.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readByte

    public byte readByte()
                  throws java.io.IOException,
                         CardTerminalException

  Reads a byte.

  Specified by:
    `readByte` in interface `java.io.DataInput`
  Returns:
    The byte read
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readChar

    public char readChar()
                  throws java.io.IOException,
                         CardTerminalException

  Reads a 16 bit char.

  Specified by:
    `readChar` in interface `java.io.DataInput`
  Returns:
    The read 16 bit char.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readDouble

    public double readDouble()
                      throws java.io.IOException,
                             CardTerminalException

  Reads a 64 bit double.

  Specified by:
    `readDouble` in interface `java.io.DataInput`
  Returns:
    The read 64 bit double.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readFloat

    public float readFloat()
                    throws java.io.IOException,
                           CardTerminalException

  Reads a 32 bit float.

  Specified by:
    `readFloat` in interface `java.io.DataInput`
  Returns:
    The read 32 bit float.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readFully

    public void readFully(byte[] b)
                   throws java.io.IOException,
                          CardTerminalException

  Reads bytes, blocking until all bytes are read.

  Specified by:
    `readFully` in interface `java.io.DataInput`
  Parameters:
    `b` - The buffer into which the data is read
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readFully

    public void readFully(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException,
                          CardTerminalException

  Reads bytes, blocking until all bytes are read.

  Specified by:
    `readFully` in interface `java.io.DataInput`
  Parameters:
    `b` - The buffer into which the data is read
    `off` - The start offset of the data
    `len` - The number of bytes to read
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readInt

    public int readInt()
                throws java.io.IOException,
                       CardTerminalException

  Reads a 32 bit int.

  Specified by:
    `readInt` in interface `java.io.DataInput`
  Returns:
    The read 32 bit integer.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readLine

    public java.lang.String readLine()
                              throws java.io.IOException,
                                     CardTerminalException

  Reads a line terminated by a '\n' or EOF.

  Specified by:
    `readLine` in interface `java.io.DataInput`
  Returns:
    A string containing the read line.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readLong

    public long readLong()
                  throws java.io.IOException,
                         CardTerminalException

  Reads a 64 bit long.

  Specified by:
    `readLong` in interface `java.io.DataInput`
  Returns:
    The read 64 bit long.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readShort

    public short readShort()
                    throws java.io.IOException,
                           CardTerminalException

  Reads a 16 bit short.

  Specified by:
    `readShort` in interface `java.io.DataInput`
  Returns:
    The read 16 bit short.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readUnsignedByte

    public int readUnsignedByte()
                         throws java.io.IOException,
                                CardTerminalException

  Reads an unsigned 8 bit byte.

  Specified by:
    `readUnsignedByte` in interface `java.io.DataInput`
  Returns:
    The 8 bit byte read.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readUnsignedShort

    public int readUnsignedShort()
                          throws java.io.IOException,
                                 CardTerminalException

  Reads 16 bit unsigned short.

  Specified by:
    `readUnsignedShort` in interface `java.io.DataInput`
  Returns:
    The read 16 bit unsigned short.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### skipBytes

    public int skipBytes(int n)
                  throws java.io.IOException,
                         CardTerminalException

  Skips the number of bytes specified.

  Specified by:
    `skipBytes` in interface `java.io.DataInput`
  Parameters:
    `n` - The number of bytes to skip
  Returns:
    The number of bytes actually skipped.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### readUTF

    public java.lang.String readUTF()
                             throws java.io.IOException,
                                    CardTerminalException

  Reads a UTF formatted String.

  Specified by:
    `readUTF` in interface `java.io.DataInput`
  Returns:
    A string with the read UTF string.
  Throws:
    `java.io.IOException` - Thrown If an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### write

    public void write(int b)
               throws java.io.IOException,
                      CardTerminalException

  Writes a byte of data. This method will block until the byte is actually written.

  Specified by:
    `write` in interface `java.io.DataOutput`
  Parameters:
    `b` - The byte to be written
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### write

    public void write(byte[] b)
               throws java.io.IOException,
                      CardTerminalException

  Writes an array of bytes. Will block until the bytes are actually written.

  Specified by:
    `write` in interface `java.io.DataOutput`
  Parameters:
    `b` - The data to be written
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### write

    public void write(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException,
                      CardTerminalException

  Writes a slice of a byte array.

  Specified by:
    `write` in interface `java.io.DataOutput`
  Parameters:
    `b` - The data to be written
    `off` - The start offset in the data
    `len` - The number of bytes that are written
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeBoolean

    public void writeBoolean(boolean v)
                      throws java.io.IOException,
                             CardTerminalException

  Writes a boolean.

  Specified by:
    `writeBoolean` in interface `java.io.DataOutput`
  Parameters:
    `v` - The boolean value
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeByte

    public void writeByte(int v)
                   throws java.io.IOException,
                          CardTerminalException

  Writes a byte.

  Specified by:
    `writeByte` in interface `java.io.DataOutput`
  Parameters:
    `v` - The byte to write.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeBytes

    public void writeBytes(java.lang.String s)
                    throws java.io.IOException,
                           CardTerminalException

  Write a String as a sequence of bytes.

  Specified by:
    `writeBytes` in interface `java.io.DataOutput`
  Parameters:
    `s` - The String to write.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeChar

    public void writeChar(int v)
                   throws java.io.IOException,
                          CardTerminalException

  Writes a character.

  Specified by:
    `writeChar` in interface `java.io.DataOutput`
  Parameters:
    `v` - The char to write
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeChars

    public void writeChars(java.lang.String s)
                    throws java.io.IOException,
                           CardTerminalException

  Writes a String as a sequence of chars.

  Specified by:
    `writeChars` in interface `java.io.DataOutput`
  Parameters:
    `s` - The String to write.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeDouble

    public void writeDouble(double v)
                     throws java.io.IOException,
                            CardTerminalException

  Writes a double.

  Specified by:
    `writeDouble` in interface `java.io.DataOutput`
  Parameters:
    `v` - The double to write.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeFloat

    public void writeFloat(float v)
                    throws java.io.IOException,
                           CardTerminalException

  Writes a float.

  Specified by:
    `writeFloat` in interface `java.io.DataOutput`
  Parameters:
    `v` - The float to write
  Throws:
    `java.io.IOException` - Thrown If an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeInt

    public void writeInt(int v)
                  throws java.io.IOException,
                         CardTerminalException

  Write an integer.

  Specified by:
    `writeInt` in interface `java.io.DataOutput`
  Parameters:
    `v` - The integer to write.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeLong

    public void writeLong(long v)
                   throws java.io.IOException,
                          CardTerminalException

  Writes a long.

  Specified by:
    `writeLong` in interface `java.io.DataOutput`
  Parameters:
    `v` - The long to write.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeShort

    public void writeShort(int v)
                    throws java.io.IOException,
                           CardTerminalException

  Writes a short.

  Specified by:
    `writeShort` in interface `java.io.DataOutput`
  Parameters:
    `v` - The short to write
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### writeUTF

    public void writeUTF(java.lang.String str)
                  throws java.io.IOException,
                         CardTerminalException

  Writes a String in UTF format.

  Specified by:
    `writeUTF` in interface `java.io.DataOutput`
  Parameters:
    `str` - The String to write.
  Throws:
    `java.io.IOException` - Thrown if an I/O error has occurred.
    `CardTerminalException` - Thrown when the smart card has been removed.

### finalize

    protected void finalize()
                     throws java.io.IOException

  Let the super class free any resources.

  Overrides:
    `finalize` in class `CardRandomAccess`
  Throws:
    `java.io.IOException` - An I/O error occurred during resource deallocation.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD