au.com.zip.cs
Class Editor

java.lang.Object
  extended by au.com.zip.cs.Editor
All Implemented Interfaces:
Runnable

public class Editor
extends Object
implements Runnable

Run the external editor on a file.

Author:
Cameron Simpson <cs@zip.com.au> 14aug2002
See Also:
Ttycmd

Field Summary
static String DFLT_EXTERNAL_EDITOR
          The default external editor, currently "vi".
 
Constructor Summary
Editor(File f)
          Constructs an Editor for an existing File.
 
Method Summary
static void edit(File f)
          Edit the supplied File with the external editor.
static String edit(String txt)
          Edit the supplied text string with the external editor.
static String getEditor()
          Get the default external editor.
 String getText()
          Return the text currently stored in the file being edited.
 void run()
           
static void setEditor(String ne)
          Set the default external editor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DFLT_EXTERNAL_EDITOR

public static final String DFLT_EXTERNAL_EDITOR
The default external editor, currently "vi". This value is used if the system property au.com.zip.cs.env.EDITOR is not set.

See Also:
Util.getenv(String), Constant Field Values
Constructor Detail

Editor

public Editor(File f)
Constructs an Editor for an existing File.

Parameters:
f - the File to edit
Method Detail

getEditor

public static final String getEditor()
Get the default external editor.

Returns:
the default external editor

setEditor

public static final void setEditor(String ne)
Set the default external editor.

Parameters:
ne - the new external editor

getText

public final String getText()
                     throws IOException
Return the text currently stored in the file being edited.

Returns:
the text
Throws:
IOException

edit

public static void edit(File f)
Edit the supplied File with the external editor.

Parameters:
f - the File to edit

edit

public static String edit(String txt)
                   throws IOException
Edit the supplied text string with the external editor.

Parameters:
txt - the text to edit
Returns:
the edited text
Throws:
IOException

run

public void run()
Specified by:
run in interface Runnable