Modifier and Type | Field and Description |
---|---|
private static Properties |
envVars |
private static String |
MASKED_SLASH_PLACEHOLDER
Placeholder during translatePath computing
|
Modifier | Constructor and Description |
---|---|
private |
IoHelper()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
static void |
chmod(File file,
String permissions)
Changes the permissions of the given file to the given POSIX permissions.
|
static void |
chmod(String path,
String permissions)
Changes the permissions of the given file to the given POSIX permissions.
|
static void |
copyFile(File inFile,
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(File inFile,
File outFile,
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(File inFile,
File outFile,
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(File inFile,
File outFile,
String permissions,
VariableSubstitutor vs,
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(File inFile,
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(String inFile,
String outFile)
Copies the contents of inFile into outFile.
|
static File |
copyToTempFile(File template,
String defaultExtension)
Creates a temp file with delete on exit rule.
|
static File |
copyToTempFile(File template,
String defaultExtension,
VariableSubstitutor vss)
Creates a temp file with delete on exit rule.
|
static File |
copyToTempFile(String template,
String defaultExtension)
Creates a temp file with delete on exit rule.
|
static File |
existingParent(File path)
Returns the first existing parent directory in a path
|
private static long |
extractLong(String in,
int assumedPlace,
int halfRange,
String useNotIdentifier)
Extracts a long value from a string in a special manner.
|
static String |
getenv(String key)
Returns the value of the environment variable given by key.
|
static long |
getFreeSpace(String path)
Returns the free (disk) space for the given path.
|
static String |
getPrimaryGroup()
Returns the primary group of the current user.
|
private static void |
loadEnv()
Loads all environment variables via an exec.
|
static String |
replaceString(String destination,
String what,
String with)
Returns a string resulting from replacing all occurrences of what in this string with with.
|
private static void |
setEnvVar(String var)
Extracts key and value from the given string var.
|
static boolean |
supported(String method)
Returns whether the given method will be supported with the given environment.
|
static String |
translatePath(String destination,
VariableSubstitutor vs)
Translates a relative path to a local system path.
|
private static final String MASKED_SLASH_PLACEHOLDER
private static Properties envVars
private IoHelper()
public static void copyFile(String inFile, String outFile) throws IOException
inFile
- path of file which should be copiedoutFile
- path of file to create and copy the contents of inFile intoIOException
public static void copyFile(File inFile, File outFile) throws IOException
inFile
- File object for inputoutFile
- File object for outputIOException
- if an I/O error occurspublic static void copyFile(File inFile, File outFile, String permissions) throws IOException
inFile
- File object for inputoutFile
- File object for outputpermissions
- permissions for the output fileIOException
- if an I/O error occurspublic static void copyFile(File inFile, File outFile, VariableSubstitutor vss) throws IOException
inFile
- File object for inputoutFile
- File object for outputvss
- substitutor which is used during copyingIOException
- if an I/O error occurspublic static void copyFile(File inFile, File outFile, String permissions, VariableSubstitutor vs) throws IOException
inFile
- File object for inputoutFile
- File object for outputpermissions
- permissions for the output filevs
- substitutor which is used during copyingIOException
- if an I/O error occurspublic static void copyFile(File inFile, File outFile, String permissions, VariableSubstitutor vs, String type) throws 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 substitutorIOException
- if an I/O error occurspublic static File copyToTempFile(File template, String defaultExtension) throws IOException
template
- file to copy from and define file extensiondefaultExtension
- file extension if no is contained in templateIOException
public static File copyToTempFile(File template, String defaultExtension, VariableSubstitutor vss) throws IOException
template
- file to copy from and define file extensiondefaultExtension
- file extension if no is contained in templatevss
- substitutor which is used during copyingIOException
public static File copyToTempFile(String template, String defaultExtension) throws IOException
template
- file to copy from and define file extensiondefaultExtension
- file extension if no is contained in templateIOException
public static void chmod(File file, String permissions) throws IOException
file
- the file for which the permissions should be changedpermissions
- POSIX permissions to be setIOException
- if an I/O error occurspublic static void chmod(String path, String permissions) throws IOException
path
- the absolute path of the file for which the permissions should be changedpermissions
- POSIX permissions to be setIOException
- if an I/O error occurspublic static long getFreeSpace(String path)
path
- path for which the free space should be detectedpublic static boolean supported(String method)
method
- name of the methodRuntimeException
- if the given method name does not existpublic static File existingParent(File path)
path
- path which should be scannedprivate static long extractLong(String in, int assumedPlace, int halfRange, 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 ignoredpublic static String getPrimaryGroup()
public static String replaceString(String destination, String what, String with)
destination
- string for which the replacing should be performedwhat
- what string should be replacedwith
- with what string what should be replacedpublic static String translatePath(String destination, VariableSubstitutor vs)
destination
- The path to translate.public static String getenv(String key)
key
- variable name for which the value should be resolvedprivate static void loadEnv()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses