Package cx.ath.matthew.io

# Class ExecOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
cx.ath.matthew.io.ExecOutputStream

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

public class ExecOutputStream extends FilterOutputStream
Class to pipe an OutputStream through a command using stdin/stdout. E.g.

        Writer w = new OutputStreamWriter(new ExecOutputStream(new FileOutputStream("file"), "command"));

## Field Summary

### Fields inherited from class java.io.FilterOutputStream

`out`

## Constructor Summary

Constructors
Constructor
Description
`ExecOutputStream(OutputStream os, Process p)`
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.
`ExecOutputStream(OutputStream os, String cmd)`
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.
`ExecOutputStream(OutputStream os, String[] cmd)`
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.
`ExecOutputStream(OutputStream os, String[] cmd, String[] env)`
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.
`ExecOutputStream(OutputStream os, String cmd, String[] env)`
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.

## Method Summary

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

### 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

### ExecOutputStream

public ExecOutputStream(OutputStream os, Process p) throws IOException
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.

Parameters:
  `os` - Writes to this OutputStream
  `p` - Filters data through stdin/out on this Process
Throws:
  `IOException`

### ExecOutputStream

public ExecOutputStream(OutputStream os, String cmd) throws IOException
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.

Parameters:
  `os` - Writes to this OutputStream
  `cmd` - Creates a Process from this string to filter data through stdin/out
Throws:
  `IOException`

### ExecOutputStream

public ExecOutputStream(OutputStream os, String[] cmd) throws IOException
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.

Parameters:
  `os` - Writes to this OutputStream
  `cmd` - Creates a Process from this string array (command, arg, ...) to filter data through stdin/out
Throws:
  `IOException`

### ExecOutputStream

public ExecOutputStream(OutputStream os, String cmd, String[] env) throws IOException
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.

Parameters:
  `os` - Writes to this OutputStream
  `cmd` - Creates a Process from this string to filter data through stdin/out
  `env` - Setup the environment for the command
Throws:
  `IOException`

### ExecOutputStream

public ExecOutputStream(OutputStream os, String[] cmd, String[] env) throws IOException
Create a new ExecOutputStream on the given OutputStream using the process to filter the stream.

Parameters:
  `os` - Writes to this OutputStream
  `cmd` - Creates a Process from this string array (command, arg, ...) to filter data through stdin/out
  `env` - Setup the environment for the command
Throws:
  `IOException`

## Method Details

### close

public void close() throws IOException

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

### flush

public void flush() throws IOException

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

### write

public void write(byte[] b) throws IOException

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

### write

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

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

### write

public void write(int b) throws IOException

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

### finalize

public void finalize()

Overrides:
  `finalize` in class `Object`