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

## opencard.opt.iso.fs
Class CardFileInputStream

    java.lang.Object
      |
      +--java.io.InputStream
            |
            +--opencard.opt.iso.fs.CardFileInputStream

public class CardFileInputStream
extends java.io.InputStream

`CardFileInputStream` together with the accompanying `CardFileOutputStream` provides access to a `CardFile` via the familiar Java input/output stream mechanism.

This class only works on transparent files.

See Also:
  `CardFile`, `CardFileOutputStream`, `InputStream`

Constructor Summary
`CardFileInputStream(CardFile file)` Instantiate an input stream using the specified `CardFile` object.

Method Summary
`int` | `available()` Return the number of byte available for reading.
`void` | `close()` Close the input stream and release any resources associated with the stream.
`protected void` | `finalize()` Close the stream at garbage collection time.
`int` | `read()` Read a byte of data.
`int` | `read(byte[] b)` Read data into a byte array.
`int` | `read(byte[] b, int offset, int length)` Reads data into a slice of a byte array.
`long` | `skip(long n)` Skips `n` bytes of input.

Methods inherited from class java.io.InputStream
`mark, markSupported, reset`

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

Constructor Detail

### CardFileInputStream

    public CardFileInputStream(CardFile file)
                        throws java.io.IOException,
                               opencard.core.terminal.CardTerminalException,
                               CardIOException

  Instantiate an input stream using the specified `CardFile` object.
  Parameters:
    `file` - The `CardFile` object to base the input stream on.
  Throws:
    java.io.IOException - Thrown when the file open fails.
    CardIOException - The file is not found or it's type is not transparent.
    opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.

Method Detail

### available

    public int available()
                  throws java.io.IOException,
                         opencard.core.terminal.CardTerminalException

  Return the number of byte available for reading.
  Returns:
    The number of bytes available for reading without blocking.
  Throws:
    java.io.IOException - Thrown if we encounter an IO error.
    opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.
  Overrides:
    available in class java.io.InputStream

### close

    public void close()
               throws java.io.IOException,
                      opencard.core.terminal.CardTerminalException

  Close the input stream and release any resources associated with the stream.
  Throws:
    java.io.IOException - Thrown if an I/O error has occurred.
    opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.
  Overrides:
    close in class java.io.InputStream

### read

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

  Read a byte of data.
  Returns:
    The byte read, or `-1` if we reached the end of the input stream.
  Throws:
    java.io.IOException - Thrown if we encounter IO trouble.
    opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.
  Overrides:
    read in class java.io.InputStream

### read

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

  Read data into a byte array.
  Parameters:
    `b` - The buffer to use.
  Returns:
    The actual number of bytes read, or `-1` if we reached the end of the input stream.
  Throws:
    java.io.IOException - Thrown if an IO error occured.
    opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.
  Overrides:
    read in class java.io.InputStream

### read

    public int read(byte[] b,
                    int offset,
                    int length)
             throws java.io.IOException,
                    opencard.core.terminal.CardTerminalException

  Reads data into a slice of a byte array.
  Parameters:
    `b` - The buffer into which the data is read
    `offset` - The start offset of the data
    `length` - The maximum number of bytes to be read
  Returns:
    The actual number of bytes read, or `-1` if we reached end of the rainbow, err, input stream.
  Throws:
    java.io.IOException - Thrown if an I/O error has occured.
    opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.
  Overrides:
    read in class java.io.InputStream

### skip

    public long skip(long n)
              throws java.io.IOException,
                     opencard.core.terminal.CardTerminalException

  Skips `n` bytes of input.
  Parameters:
    `n` - The number of bytes to be skipped
  Returns:
    The actual number of bytes skipped.
  Throws:
    java.io.IOException - Thrown when `skip()`ing was not possible.
    opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.
  Overrides:
    skip in class java.io.InputStream

### finalize

    protected void finalize()
                     throws java.io.IOException

  Close the stream at garbage collection time.
  Throws:
    java.io.IOException - Thrown when we encountered an IO error.
  Overrides:
    finalize in class java.lang.Object

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