Package cx.ath.matthew.io

# Class ExecInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
cx.ath.matthew.io.ExecInputStream

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class ExecInputStream extends FilterInputStream
Class to pipe an InputStream through a command using stdin/stdout. E.g.

        Reader r = new InputStreamReader(new ExecInputStream(new FileInputStream("file"), "command"));

## Field Summary

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

`in`

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`int`
`available()`
`void`
`close()`
`void`
`finalize()`
`void`
`flush()`
`void`
`mark(int readlimit)`
`boolean`
`markSupported()`
`int`
`read()`
`int`
`read(byte[] b)`
`int`
`read(byte[] b, int off, int len)`
`void`
`reset()`
`long`
`skip(long n)`

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

`nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo`

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

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

## Constructor Details

### ExecInputStream

public ExecInputStream(InputStream is, Process p) throws IOException
Create a new ExecInputStream on the given InputStream using the process to filter the stream.

Parameters:
  `is` - Reads from this InputStream
  `p` - Filters data through stdin/out on this Process
Throws:
  `IOException`

### ExecInputStream

public ExecInputStream(InputStream is, String cmd) throws IOException
Create a new ExecInputStream on the given InputStream using the process to filter the stream.

Parameters:
  `is` - Reads from this InputStream
  `cmd` - Creates a Process from this string to filter data through stdin/out
Throws:
  `IOException`

### ExecInputStream

public ExecInputStream(InputStream is, String[] cmd) throws IOException
Create a new ExecInputStream on the given InputStream using the process to filter the stream.

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

### ExecInputStream

public ExecInputStream(InputStream is, String cmd, String[] env) throws IOException
Create a new ExecInputStream on the given InputStream using the process to filter the stream.

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

### ExecInputStream

public ExecInputStream(InputStream is, String[] cmd, String[] env) throws IOException
Create a new ExecInputStream on the given InputStream using the process to filter the stream.

Parameters:
  `is` - Reads from this InputStream
  `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 `FilterInputStream`
Throws:
  `IOException`

### flush

public void flush() throws IOException

Throws:
  `IOException`

### available

public int available() throws IOException

Overrides:
  `available` in class `FilterInputStream`
Throws:
  `IOException`

### read

public int read() throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### read

public int read(byte[] b) throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### read

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

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### skip

public long skip(long n) throws IOException

Overrides:
  `skip` in class `FilterInputStream`
Throws:
  `IOException`

### mark

public void mark(int readlimit)

Overrides:
  `mark` in class `FilterInputStream`

### markSupported

public boolean markSupported()

Overrides:
  `markSupported` in class `FilterInputStream`

### reset

public void reset()

Overrides:
  `reset` in class `FilterInputStream`

### finalize

public void finalize()

Overrides:
  `finalize` in class `Object`