Package sop.util

# Class ProxyOutputStream

java.lang.Object
java.io.OutputStream
sop.util.ProxyOutputStream

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

public class ProxyOutputStream extends OutputStream
`OutputStream` that buffers data being written into it, until its underlying output stream is being replaced. At that point, first all the buffered data is being written to the underlying stream, followed by any successive data that may get written to the `ProxyOutputStream`.

This class is useful if we need to provide an `OutputStream` at one point in time when the final target output stream is not yet known.

## Constructor Summary

Constructors
Constructor
Description
`ProxyOutputStream()`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`flush()`
`void`
`replaceOutputStream(OutputStream underlying)`
`void`
`write(byte[] b)`
`void`
`write(byte[] b, int off, int len)`
`void`
`write(int i)`

### Methods inherited from class java.io.OutputStream

`nullOutputStream`

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

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

## Constructor Details

### ProxyOutputStream

public ProxyOutputStream()

## Method Details

### replaceOutputStream

public void replaceOutputStream(OutputStream underlying) throws IOException

Throws:
  `IOException`

### write

public void write(byte[] b) throws IOException

Overrides:
  `write` in class `OutputStream`
Throws:
  `IOException`

### write

public void write(byte[] b, int off, int len) throws IOException

Overrides:
  `write` in class `OutputStream`
Throws:
  `IOException`

### flush

public void flush() throws IOException

Specified by:
  `flush` in interface `Flushable`
Overrides:
  `flush` in class `OutputStream`
Throws:
  `IOException`

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `OutputStream`
Throws:
  `IOException`

### write

public void write(int i) throws IOException

Specified by:
  `write` in class `OutputStream`
Throws:
  `IOException`