com.codemesh.terp.eval.executors
Class FileContentsSetter
java.lang.Object
com.codemesh.terp.api.Executor.AbstractExecutor<Lvalue>
com.codemesh.terp.eval.executors.FileContentsSetter
- All Implemented Interfaces:
- Executor<Lvalue>
public class FileContentsSetter
- extends Executor.AbstractExecutor<Lvalue>
The setter for file contents.
|
Field Summary |
static java.lang.String |
BYTES
|
static java.lang.String |
LINES
|
static java.lang.String |
TEXT
|
|
Method Summary |
static void |
appendContents(java.io.File file,
byte[] contents)
|
static void |
appendText(java.io.File file,
java.lang.String text)
|
static void |
appendText(java.io.File file,
java.lang.String text,
java.lang.String encoding)
|
Lvalue |
execute(java.util.List<java.lang.Object> args,
TerpEvaluator eval,
TerpContext ctx)
Performs the executor's action on the given arguments in the given context. |
boolean |
matches(java.util.List<java.lang.Object> args)
Returns true if the executor applies to the given arguments. |
static void |
setContents(java.io.File file,
byte[] contents)
|
static void |
setText(java.io.File file,
java.lang.String text)
|
static void |
setText(java.io.File file,
java.lang.String text,
java.lang.String encoding)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BYTES
public static final java.lang.String BYTES
- See Also:
- Constant Field Values
LINES
public static final java.lang.String LINES
- See Also:
- Constant Field Values
TEXT
public static final java.lang.String TEXT
- See Also:
- Constant Field Values
FileContentsSetter
public FileContentsSetter(java.lang.String op)
matches
public boolean matches(java.util.List<java.lang.Object> args)
- Description copied from interface:
Executor
- Returns true if the executor applies to the given arguments.
Typically, your custom executor will implement this method to check for the proper
number of arguments and the proper argument types.
- Parameters:
args - the arguments passed to the executor.
- Returns:
- true if the executor knows how to handle the given arguments, false otherwise.
execute
public Lvalue execute(java.util.List<java.lang.Object> args,
TerpEvaluator eval,
TerpContext ctx)
- Description copied from interface:
Executor
- Performs the executor's action on the given arguments in the given context.
Typically, your custom executor will implement this method to provide its
core functionality.
- Parameters:
args - the arguments.eval - the evaluator to use. Can frequently be null.ctx - the context in which the execution occurs. Can frequently be null.
- Returns:
- the execution result.
setContents
public static void setContents(java.io.File file,
byte[] contents)
throws java.io.IOException
- Throws:
java.io.IOException
appendContents
public static void appendContents(java.io.File file,
byte[] contents)
throws java.io.IOException
- Throws:
java.io.IOException
appendText
public static void appendText(java.io.File file,
java.lang.String text)
throws java.io.IOException
- Throws:
java.io.IOException
appendText
public static void appendText(java.io.File file,
java.lang.String text,
java.lang.String encoding)
throws java.io.IOException
- Throws:
java.io.IOException
setText
public static void setText(java.io.File file,
java.lang.String text)
throws java.io.IOException
- Throws:
java.io.IOException
setText
public static void setText(java.io.File file,
java.lang.String text,
java.lang.String encoding)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 2008-2012 by Codemesh, Inc. All Rights Reserved.