Package com.pixelmed.dicom

# Class AsynchronousOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.pixelmed.dicom.AsynchronousOutputStream

All Implemented Interfaces:
  `Closeable`, `Flushable`, `AutoCloseable`

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

Constructors
Constructor
Description
`AsynchronousOutputStream(OutputStream out)`

## Method Summary

Modifier and Type
Method
Description
`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.io.OutputStream

`nullOutputStream`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AsynchronousOutputStream

public AsynchronousOutputStream(OutputStream out)

Parameters:
  `out` - the `OutputStream` to write to

## Method Details

### 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 `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `FilterOutputStream`
Throws:
  `IOException` - if an I/O error occurs.