opencard.opt.iso.fs
Class CardFileOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--opencard.opt.iso.fs.CardFileOutputStream

public class CardFileOutputStream
extends java.io.OutputStream

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

See Also:
CardFile, CardFileInputStream, InputStream

Constructor Summary
CardFileOutputStream(CardFile file)
          Instantiate an OuputStream for the specified CardFile object.
 
Method Summary
 void close()
          Closes the output stream.
protected  void finalize()
          Make sure that the output stream is closed on garbage collection.
 void flush()
          Flushes this CardFileOutputStream and forces any buffered output bytes to be written out.
 void write(byte[] b)
          Write an array of bytes.
 void write(byte[] b, int offset, int length)
          Write a slice of a byte array.
 void write(int b)
          Write a byte of data.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CardFileOutputStream

public CardFileOutputStream(CardFile file)
                     throws java.io.IOException,
                            CardIOException,
                            opencard.core.terminal.CardTerminalException
Instantiate an OuputStream for the specified CardFile object.
Parameters:
file - The file to instantiate the OutputStream for.
Throws:
java.io.IOException - Thrown if the file is not found.
opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.
Method Detail

close

public void close()
           throws java.io.IOException,
                  opencard.core.terminal.CardTerminalException
Closes the output stream. This method must be called to release any resources associated with the stream.
Throws:
java.io.IOException - 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.OutputStream

flush

public void flush()
           throws java.io.IOException,
                  opencard.core.terminal.CardTerminalException
Flushes this CardFileOutputStream and forces any buffered output bytes to be written out.
Throws:
opencard.core.terminal.CardTerminalException - Thrown when the smart card has been removed.
java.io.IOException - if an I/O error occurs.
Overrides:
flush in class java.io.OutputStream

write

public void write(int b)
           throws java.io.IOException,
                  opencard.core.terminal.CardTerminalException
Write a byte of data.
Parameters:
b - The byte to be written
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:
write in class java.io.OutputStream

write

public void write(byte[] b)
           throws java.io.IOException,
                  opencard.core.terminal.CardTerminalException
Write an array of bytes.
Parameters:
b - The data to be written
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:
write in class java.io.OutputStream

write

public void write(byte[] b,
                  int offset,
                  int length)
           throws java.io.IOException,
                  opencard.core.terminal.CardTerminalException
Write a slice of a byte array.
Parameters:
b - The data to be written
offset - The start offset in the data (not in the file!)
length - The number of bytes that are written
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:
write in class java.io.OutputStream

finalize

protected void finalize()
                 throws java.io.IOException
Make sure that the output stream is closed on garbage collection.
Throws:
java.io.IOException - Thrown when an I/O error occurs.
Overrides:
finalize in class java.lang.Object