Class DataPump

java.lang.Object
org.sentrysoftware.jawk.jrt.DataPump
All Implemented Interfaces:
Runnable

public class DataPump extends Object implements Runnable
Relay data from an input stream to an output stream. A thread is created to do the work.

Jawk uses data pumps to relay stdin, stdout, and stderr of a spawned process (by, for example, system() or "cmd" | getline) to the stdin, stdout, and/or stderr of the calling process (the interpreter itself).

Author:
Danny Daglas
  • Constructor Details

    • DataPump

      public DataPump(InputStream in, PrintStream out)
      Represents a data pump.
      Parameters:
      in - The input stream.
      out - The output stream.
  • Method Details

    • dump

      public static void dump(String desc, InputStream in, PrintStream out)
      Allocate the data pump and start the thread.
      Parameters:
      desc - A human-readable description of this data pump. It is part of the thread name, and, therefore, visible upon a VM thread dump.
      in - The input stream.
      out - The output stream.
    • run

      public final void run()
      VM entry point for the thread. It performs the data relay.
      Specified by:
      run in interface Runnable