frysk.sys
Class PipePair

java.lang.Object
  extended by frysk.sys.PipePair

public abstract class PipePair
extends Object

An abstract class for creating a pair of pipes wired up to a child process, with OUT wired to the child's STDIN, and IN wired to the child's stdout. The child process is created using the method spawn.


Field Summary
 FileDescriptor in
          Read from this file descriptor.
 FileDescriptor out
          Write to this file descriptor.
 ProcessIdentifier pid
          File descriptor of process wired to the pipe.
 
Constructor Summary
protected PipePair(String[] args)
          Create a pipe-pair and then wire it up.
 
Method Summary
static PipePair child(String[] args)
           
private static int child(String exe, String[] args, int in_in, int in_out, int out_in, int out_out)
           
 void close()
          Shut down the pipes.
static PipePair daemon(String[] args)
           
private static int daemon(String exe, String[] args, int in_in, int in_out, int out_in, int out_out)
           
(package private) abstract  int spawn(String[] args, Pipe in, Pipe out)
          Called from the context of the child process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

public final FileDescriptor out
Write to this file descriptor.


in

public final FileDescriptor in
Read from this file descriptor.


pid

public final ProcessIdentifier pid
File descriptor of process wired to the pipe.

Constructor Detail

PipePair

protected PipePair(String[] args)
Create a pipe-pair and then wire it up. this.out > [ out.out | out.in > child > in.out | in.in ] > this.in Spawn is parameterized with the Object o, allowing custom behavior. The child must close to.out and from.in.

Method Detail

spawn

abstract int spawn(String[] args,
                   Pipe in,
                   Pipe out)
Called from the context of the child process.


close

public void close()
Shut down the pipes.


daemon

public static PipePair daemon(String[] args)

daemon

private static int daemon(String exe,
                          String[] args,
                          int in_in,
                          int in_out,
                          int out_in,
                          int out_out)

child

public static PipePair child(String[] args)

child

private static int child(String exe,
                         String[] args,
                         int in_in,
                         int in_out,
                         int out_in,
                         int out_out)