Class 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"));
 
  • 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