tcl.lang.process
Class Redirect

java.lang.Object
  extended by tcl.lang.process.Redirect

public class Redirect
extends Object

Represents a redirection on one of the streams attached to a TclProcess. Inspired by the Java 1.7 API.


Nested Class Summary
static class Redirect.Type
          The types of redirection that can be defined
 
Field Summary
protected  boolean appendToFile
          If true, append to file
protected  Channel channel
          The Channel object, for TCL_CHANNEL redirects
protected  boolean closeChannel
          If true, close channel when complete
protected  File file
          The File object, for FILE redirects
protected  InputStream inputStream
          An inputStream, for STREAM redirects
protected  OutputStream outputStream
          And output stream, for STREAM redirects
protected  TclProcess pipePartner
          The TclProcess on the other side of the pipe, for PIPE redirects
protected  String specifiedFilePath
          A filename for file directs as specified to Tcl; used for error messages
protected  Redirect.Type type
          The kind of redirection (see enum Type)
 
Constructor Summary
Redirect(Channel channel, boolean close)
          Create a Tcl Channel redirect
Redirect(File f, String specifiedPath, boolean append)
          Create a File redirect
Redirect(TclProcess partner)
          Create a PIPE redirect
 
Method Summary
 InputStream getInputStream()
           
 OutputStream getOutputStream()
           
 Redirect.Type getType()
           
static Redirect inherit()
           
 void setInputStream(InputStream inputStream)
           
 void setOutputStream(OutputStream outputStream)
           
static Redirect stderrToStdout()
           
static Redirect stream()
          Create an STREAM redirect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected Redirect.Type type
The kind of redirection (see enum Type)


channel

protected Channel channel
The Channel object, for TCL_CHANNEL redirects


file

protected File file
The File object, for FILE redirects


specifiedFilePath

protected String specifiedFilePath
A filename for file directs as specified to Tcl; used for error messages


pipePartner

protected TclProcess pipePartner
The TclProcess on the other side of the pipe, for PIPE redirects


closeChannel

protected boolean closeChannel
If true, close channel when complete


appendToFile

protected boolean appendToFile
If true, append to file


inputStream

protected InputStream inputStream
An inputStream, for STREAM redirects


outputStream

protected OutputStream outputStream
And output stream, for STREAM redirects

Constructor Detail

Redirect

public Redirect(TclProcess partner)
Create a PIPE redirect

Parameters:
partner - TclProcess on the other side of the pipe. This Redirect object is attached to the TclProcess on this side of the pipe.

Redirect

public Redirect(File f,
                String specifiedPath,
                boolean append)
Create a File redirect

Parameters:
f - File to redirect bytes from/to
specifiedPath - File name as specified to Tcl; used for error messages

Redirect

public Redirect(Channel channel,
                boolean close)
Create a Tcl Channel redirect

Parameters:
channel - to redirect bytes from/to
close - if true, close channel on process exit
Method Detail

stream

public static Redirect stream()
Create an STREAM redirect


inherit

public static Redirect inherit()
Returns:
a new INHERIT redirect

stderrToStdout

public static Redirect stderrToStdout()
Returns:
a new redirect to merge stderr with stdout

getType

public Redirect.Type getType()
Returns:
This Redirect's type

getInputStream

public InputStream getInputStream()
Returns:
the inputStream for STREAM redirects

setInputStream

public void setInputStream(InputStream inputStream)
Parameters:
inputStream - the inputStream to set for STREAM redirects. Must be set by TclProcess subclass.

getOutputStream

public OutputStream getOutputStream()
Returns:
the outputStream for STREAM redirects

setOutputStream

public void setOutputStream(OutputStream outputStream)
Parameters:
outputStream - the outputStream to set for STREAM redirects. Must be set by TclProcess subclass.


Copyright © 2015. All rights reserved.