public class ScriptfileUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ScriptfileUtils.LineEndingStyle
Line ending style
|
Constructor and Description |
---|
ScriptfileUtils() |
Modifier and Type | Method and Description |
---|---|
static java.io.File |
createTempFile(Framework framework)
Creates a temp file and marks it for deleteOnExit, to clean up proactively call
releaseTempFile(java.io.File) with the result when complete |
static ScriptfileUtils.LineEndingStyle |
lineEndingStyleForNode(INodeEntry node) |
static boolean |
releaseTempFile(java.io.File file)
Remove a file that may have been created by
createTempFile(com.dtolabs.rundeck.core.common.Framework) . |
static void |
setExecutePermissions(java.io.File scriptfile)
Set the executable flag on a file if supported by the OS
|
static void |
writeScriptFile(java.io.InputStream stream,
java.lang.String scriptString,
java.io.Reader reader,
ScriptfileUtils.LineEndingStyle style,
java.io.File scriptfile)
Write script content to a destination file from one of the sources
|
static java.io.File |
writeScriptTempfile(Framework framework,
java.io.InputStream stream,
java.lang.String source,
java.io.Reader reader,
ScriptfileUtils.LineEndingStyle style)
Copy a source stream or string content to a tempfile for script execution
|
static java.io.File |
writeScriptTempfile(Framework framework,
java.io.Reader source,
ScriptfileUtils.LineEndingStyle style)
Copy reader content to a tempfile for script execution
|
public static ScriptfileUtils.LineEndingStyle lineEndingStyleForNode(INodeEntry node)
node
- nodepublic static java.io.File writeScriptTempfile(Framework framework, java.io.Reader source, ScriptfileUtils.LineEndingStyle style) throws java.io.IOException
framework
- frameworksource
- string contentstyle
- stylejava.io.IOException
- if an error occurspublic static java.io.File writeScriptTempfile(Framework framework, java.io.InputStream stream, java.lang.String source, java.io.Reader reader, ScriptfileUtils.LineEndingStyle style) throws java.io.IOException
framework
- frameworkstream
- source streamsource
- contentstyle
- file line ending style to usereader
- readerjava.io.IOException
- if an error occurspublic static void writeScriptFile(java.io.InputStream stream, java.lang.String scriptString, java.io.Reader reader, ScriptfileUtils.LineEndingStyle style, java.io.File scriptfile) throws java.io.IOException
stream
- stream sourcescriptString
- script contentreader
- reader sourcestyle
- line ending stylescriptfile
- destination filejava.io.IOException
- on io errorpublic static java.io.File createTempFile(Framework framework) throws java.io.IOException
releaseTempFile(java.io.File)
with the result when completeframework
- fwkjava.io.IOException
- on io errorpublic static boolean releaseTempFile(java.io.File file)
createTempFile(com.dtolabs.rundeck.core.common.Framework)
.
If the file was not created that way, it will not be deleted.file
- a temp file created with createTempFile(com.dtolabs.rundeck.core.common.Framework)
public static void setExecutePermissions(java.io.File scriptfile) throws java.io.IOException
scriptfile
- target filejava.io.IOException
- if an error occurs