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
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
ConstructorsConstructorDescriptionExecInputStream
(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
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
ExecInputStream
Create a new ExecInputStream on the given InputStream using the process to filter the stream.- Parameters:
is
- Reads from this InputStreamp
- Filters data through stdin/out on this Process- Throws:
IOException
-
ExecInputStream
Create a new ExecInputStream on the given InputStream using the process to filter the stream.- Parameters:
is
- Reads from this InputStreamcmd
- Creates a Process from this string to filter data through stdin/out- Throws:
IOException
-
ExecInputStream
Create a new ExecInputStream on the given InputStream using the process to filter the stream.- Parameters:
is
- Reads from this InputStreamcmd
- Creates a Process from this string array (command, arg, ...) to filter data through stdin/out- Throws:
IOException
-
ExecInputStream
Create a new ExecInputStream on the given InputStream using the process to filter the stream.- Parameters:
is
- Reads from this InputStreamcmd
- Creates a Process from this string to filter data through stdin/outenv
- Setup the environment for the command- Throws:
IOException
-
ExecInputStream
Create a new ExecInputStream on the given InputStream using the process to filter the stream.- Parameters:
is
- Reads from this InputStreamcmd
- Creates a Process from this string array (command, arg, ...) to filter data through stdin/outenv
- Setup the environment for the command- Throws:
IOException
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
flush
- Throws:
IOException
-
available
- Overrides:
available
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
mark
in classFilterInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classFilterInputStream
-
reset
public void reset()- Overrides:
reset
in classFilterInputStream
-
finalize
public void finalize()
-