opencard.opt.iso.fs
Class CardFileOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by opencard.opt.iso.fs.CardFileOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

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.

Version:
$Id: CardFileOutputStream.java,v 1.2 1999/11/03 12:37:17 damke Exp $
Author:
Peter Trommler (trp@zurich.ibm.com), Dirk Husemann (hud@zurich.ibm.com)
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,
                            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.
CardTerminalException - Thrown when the smart card has been removed.
CardIOException
Method Detail

close

public void close()
           throws java.io.IOException,
                  CardTerminalException
Closes the output stream. This method must be called to release any resources associated with the stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - If an I/O error has occurred.
CardTerminalException - Thrown when the smart card has been removed.

flush

public void flush()
           throws java.io.IOException,
                  CardTerminalException
Flushes this CardFileOutputStream and forces any buffered output bytes to be written out.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
CardTerminalException - Thrown when the smart card has been removed.
java.io.IOException - if an I/O error occurs.

write

public void write(int b)
           throws java.io.IOException,
                  CardTerminalException
Write a byte of data.

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

write

public void write(byte[] b)
           throws java.io.IOException,
                  CardTerminalException
Write an array of bytes.

Overrides:
write in class java.io.OutputStream
Parameters:
b - The data to be written
Throws:
java.io.IOException - Thrown if an I/O error has occured.
CardTerminalException - Thrown when the smart card has been removed.

write

public void write(byte[] b,
                  int offset,
                  int length)
           throws java.io.IOException,
                  CardTerminalException
Write a slice of a byte array.

Overrides:
write in class java.io.OutputStream
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.
CardTerminalException - Thrown when the smart card has been removed.

finalize

protected void finalize()
                 throws java.io.IOException
Make sure that the output stream is closed on garbage collection.

Overrides:
finalize in class java.lang.Object
Throws:
java.io.IOException - Thrown when an I/O error occurs.