|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.izforge.izpack.util.IoHelper
Class with some IO related helper.
Field Summary | |
private static java.util.Properties |
envVars
|
private static java.lang.String |
MASKED_SLASH_PLACEHOLDER
Placeholder during translatePath computing |
Constructor Summary | |
private |
IoHelper()
Default constructor |
Method Summary | |
static void |
chmod(java.io.File file,
java.lang.String permissions)
Changes the permissions of the given file to the given POSIX permissions. |
static void |
chmod(java.lang.String path,
java.lang.String permissions)
Changes the permissions of the given file to the given POSIX permissions. |
static void |
copyFile(java.io.File inFile,
java.io.File outFile)
Creates an in- and output stream for the given File objects and copies all the data from the specified input to the specified output. |
static void |
copyFile(java.io.File inFile,
java.io.File outFile,
java.lang.String permissions)
Creates an in- and output stream for the given File objects and copies all the data from the specified input to the specified output. |
static void |
copyFile(java.io.File inFile,
java.io.File outFile,
java.lang.String permissions,
VariableSubstitutor vs)
Creates an in- and output stream for the given File objects and copies all the data from the specified input to the specified output. |
static void |
copyFile(java.io.File inFile,
java.io.File outFile,
java.lang.String permissions,
VariableSubstitutor vs,
java.lang.String type)
Creates an in- and output stream for the given File objects and copies all the data from the specified input to the specified output. |
static void |
copyFile(java.io.File inFile,
java.io.File outFile,
VariableSubstitutor vss)
Creates an in- and output stream for the given File objects and copies all the data from the specified input to the specified output. |
static void |
copyFile(java.lang.String inFile,
java.lang.String outFile)
Copies the contents of inFile into outFile. |
static java.io.File |
copyToTempFile(java.io.File template,
java.lang.String defaultExtension)
Creates a temp file with delete on exit rule. |
static java.io.File |
copyToTempFile(java.io.File template,
java.lang.String defaultExtension,
VariableSubstitutor vss)
Creates a temp file with delete on exit rule. |
static java.io.File |
copyToTempFile(java.lang.String template,
java.lang.String defaultExtension)
Creates a temp file with delete on exit rule. |
static java.io.File |
existingParent(java.io.File path)
Returns the first existing parent directory in a path |
private static long |
extractLong(java.lang.String in,
int assumedPlace,
int halfRange,
java.lang.String useNotIdentifier)
Extracts a long value from a string in a special manner. |
static java.lang.String |
getenv(java.lang.String key)
Returns the value of the environment variable given by key. |
static long |
getFreeSpace(java.lang.String path)
Returns the free (disk) space for the given path. |
static java.lang.String |
getPrimaryGroup()
Returns the primary group of the current user. |
private static void |
loadEnv()
Loads all environment variables via an exec. |
static java.lang.String |
replaceString(java.lang.String destination,
java.lang.String what,
java.lang.String with)
Returns a string resulting from replacing all occurrences of what in this string with with. |
private static void |
setEnvVar(java.lang.String var)
Extracts key and value from the given string var. |
static boolean |
supported(java.lang.String method)
Returns whether the given method will be supported with the given environment. |
static java.lang.String |
translatePath(java.lang.String destination,
VariableSubstitutor vs)
Translates a relative path to a local system path. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String MASKED_SLASH_PLACEHOLDER
private static java.util.Properties envVars
Constructor Detail |
private IoHelper()
Method Detail |
public static void copyFile(java.lang.String inFile, java.lang.String outFile) throws java.io.IOException
inFile
- path of file which should be copiedoutFile
- path of file to create and copy the contents of inFile into
java.io.IOException
public static void copyFile(java.io.File inFile, java.io.File outFile) throws java.io.IOException
inFile
- File object for inputoutFile
- File object for output
java.io.IOException
- if an I/O error occurspublic static void copyFile(java.io.File inFile, java.io.File outFile, java.lang.String permissions) throws java.io.IOException
inFile
- File object for inputoutFile
- File object for outputpermissions
- permissions for the output file
java.io.IOException
- if an I/O error occurspublic static void copyFile(java.io.File inFile, java.io.File outFile, VariableSubstitutor vss) throws java.io.IOException
inFile
- File object for inputoutFile
- File object for outputvss
- substitutor which is used during copying
java.io.IOException
- if an I/O error occurspublic static void copyFile(java.io.File inFile, java.io.File outFile, java.lang.String permissions, VariableSubstitutor vs) throws java.io.IOException
inFile
- File object for inputoutFile
- File object for outputpermissions
- permissions for the output filevs
- substitutor which is used during copying
java.io.IOException
- if an I/O error occurspublic static void copyFile(java.io.File inFile, java.io.File outFile, java.lang.String permissions, VariableSubstitutor vs, java.lang.String type) throws java.io.IOException
inFile
- File object for inputoutFile
- File object for outputpermissions
- permissions for the output filevs
- substitutor which is used during copyingtype
- file type for the substitutor
java.io.IOException
- if an I/O error occurspublic static java.io.File copyToTempFile(java.io.File template, java.lang.String defaultExtension) throws java.io.IOException
template
- file to copy from and define file extensiondefaultExtension
- file extension if no is contained in template
java.io.IOException
public static java.io.File copyToTempFile(java.io.File template, java.lang.String defaultExtension, VariableSubstitutor vss) throws java.io.IOException
template
- file to copy from and define file extensiondefaultExtension
- file extension if no is contained in templatevss
- substitutor which is used during copying
java.io.IOException
public static java.io.File copyToTempFile(java.lang.String template, java.lang.String defaultExtension) throws java.io.IOException
template
- file to copy from and define file extensiondefaultExtension
- file extension if no is contained in template
java.io.IOException
public static void chmod(java.io.File file, java.lang.String permissions) throws java.io.IOException
file
- the file for which the permissions should be changedpermissions
- POSIX permissions to be set
java.io.IOException
- if an I/O error occurspublic static void chmod(java.lang.String path, java.lang.String permissions) throws java.io.IOException
path
- the absolute path of the file for which the permissions should be changedpermissions
- POSIX permissions to be set
java.io.IOException
- if an I/O error occurspublic static long getFreeSpace(java.lang.String path)
path
- path for which the free space should be detected
public static boolean supported(java.lang.String method)
method
- name of the method
java.lang.RuntimeException
- if the given method name does not existpublic static java.io.File existingParent(java.io.File path)
path
- path which should be scanned
private static long extractLong(java.lang.String in, int assumedPlace, int halfRange, java.lang.String useNotIdentifier)
in
- the string which should be parsedassumedPlace
- token number which should contain the valuehalfRange
- half range for detection rangeuseNotIdentifier
- string which determines tokens which should be ignored
public static java.lang.String getPrimaryGroup()
public static java.lang.String replaceString(java.lang.String destination, java.lang.String what, java.lang.String with)
destination
- string for which the replacing should be performedwhat
- what string should be replacedwith
- with what string what should be replaced
public static java.lang.String translatePath(java.lang.String destination, VariableSubstitutor vs)
destination
- The path to translate.
public static java.lang.String getenv(java.lang.String key)
key
- variable name for which the value should be resolved
private static void loadEnv()
private static void setEnvVar(java.lang.String var)
var
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |