com.pixelmed.dicom
Class AsynchronousOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by com.pixelmed.dicom.AsynchronousOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class AsynchronousOutputStream
extends FilterOutputStream

A class that extends FilterOutputStream by creating a separate thread to actually perform the output operations, and returning immediately from write calls, but blocking on closing.


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
AsynchronousOutputStream(OutputStream out)
           
 
Method Summary
 void close()
          Closes this output stream and releases any system resources associated with the stream.
 void flush()
          Flushes this output stream and forces any buffered output bytes to be written out to the stream.
 void write(byte[] b)
          Writes b.length bytes to this output stream.
 void write(byte[] b, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsynchronousOutputStream

public AsynchronousOutputStream(OutputStream out)
Parameters:
out -
Method Detail

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.

Overrides:
write in class FilterOutputStream
Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
IOException - if an I/O error occurs.

write

public void write(int b)
           throws IOException
Writes the specified byte to this output stream.

Overrides:
write in class FilterOutputStream
Parameters:
b - the byte.
Throws:
IOException - if an I/O error occurs.

write

public void write(byte[] b)
           throws IOException
Writes b.length bytes to this output stream.

Overrides:
write in class FilterOutputStream
Parameters:
b - the data to be written.
Throws:
IOException - if an I/O error occurs.

flush

public void flush()
           throws IOException
Flushes this output stream and forces any buffered output bytes to be written out to the stream.

Specified by:
flush in interface Flushable
Overrides:
flush in class FilterOutputStream
Throws:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
Closes this output stream and releases any system resources associated with the stream.

Specified by:
close in interface Closeable
Overrides:
close in class FilterOutputStream
Throws:
IOException - if an I/O error occurs.