| java.lang.Object com.izforge.izpack.util.IoHelper
IoHelper | public class IoHelper (Code) | |
Class with some IO related helper.
|
Method Summary | |
public static void | chmod(File file, String permissions) Changes the permissions of the given file to the given POSIX permissions. | public static void | chmod(String path, String permissions) Changes the permissions of the given file to the given POSIX permissions. | public static void | copyFile(String inFile, String outFile) Copies the contents of inFile into outFile. | public 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. | public 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. | public 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. | public 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. | public 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. | public static File | copyToTempFile(File template, String defaultExtension) Creates a temp file with delete on exit rule. | public static File | copyToTempFile(File template, String defaultExtension, VariableSubstitutor vss) Creates a temp file with delete on exit rule. | public static File | copyToTempFile(String template, String defaultExtension) Creates a temp file with delete on exit rule. | public static File | existingParent(File path) | public static long | getFreeSpace(String path) Returns the free (disk) space for the given path. | public static String | getPrimaryGroup() Returns the primary group of the current user. | public static String | getenv(String key) Returns the value of the environment variable given by key. | public static String | replaceString(String destination, String what, String with) Returns a string resulting from replacing all occurrences of what in this string with with.
In opposite to the String.replaceAll method this method do not use regular expression or
other methods which are only available in JRE 1.4 and later. | public static boolean | supported(String method) Returns whether the given method will be supported with the given environment. | public static String | translatePath(String destination, VariableSubstitutor vs) Translates a relative path to a local system path.
Parameters: destination - The path to translate. |
chmod | public static void chmod(File file, String permissions) throws IOException(Code) | | Changes the permissions of the given file to the given POSIX permissions.
Parameters: file - the file for which the permissions should be changed Parameters: permissions - POSIX permissions to be set throws: IOException - if an I/O error occurs |
chmod | public static void chmod(String path, String permissions) throws IOException(Code) | | Changes the permissions of the given file to the given POSIX permissions. This method will be
raised an exception, if the OS is not UNIX.
Parameters: path - the absolute path of the file for which the permissions should be changed Parameters: permissions - POSIX permissions to be set throws: IOException - if an I/O error occurs |
copyFile | public static void copyFile(String inFile, String outFile) throws IOException(Code) | | Copies the contents of inFile into outFile.
Parameters: inFile - path of file which should be copied Parameters: outFile - path of file to create and copy the contents of inFile into |
copyFile | public static void copyFile(File inFile, File outFile) throws IOException(Code) | | Creates an in- and output stream for the given File objects and copies all the data from the
specified input to the specified output.
Parameters: inFile - File object for input Parameters: outFile - File object for output exception: IOException - if an I/O error occurs |
copyFile | public static void copyFile(File inFile, File outFile, String permissions) throws IOException(Code) | | Creates an in- and output stream for the given File objects and copies all the data from the
specified input to the specified output. If permissions is not null, a chmod will be done on
the output file.
Parameters: inFile - File object for input Parameters: outFile - File object for output Parameters: permissions - permissions for the output file exception: IOException - if an I/O error occurs |
copyFile | public static void copyFile(File inFile, File outFile, VariableSubstitutor vss) throws IOException(Code) | | Creates an in- and output stream for the given File objects and copies all the data from the
specified input to the specified output. If the VariableSubstitutor is not null, a substition
will be done during copy.
Parameters: inFile - File object for input Parameters: outFile - File object for output Parameters: vss - substitutor which is used during copying exception: IOException - if an I/O error occurs |
copyFile | public static void copyFile(File inFile, File outFile, String permissions, VariableSubstitutor vs) throws IOException(Code) | | Creates an in- and output stream for the given File objects and copies all the data from the
specified input to the specified output. If the VariableSubstitutor is not null, a substition
will be done during copy. If permissions is not null, a chmod will be done on the output
file.
Parameters: inFile - File object for input Parameters: outFile - File object for output Parameters: permissions - permissions for the output file Parameters: vs - substitutor which is used during copying exception: IOException - if an I/O error occurs |
copyFile | public static void copyFile(File inFile, File outFile, String permissions, VariableSubstitutor vs, String type) throws IOException(Code) | | Creates an in- and output stream for the given File objects and copies all the data from the
specified input to the specified output. If the VariableSubstitutor is not null, a substition
will be done during copy. If permissions is not null, a chmod will be done on the output
file. If type is not null, that type is used as file type at substitution.
Parameters: inFile - File object for input Parameters: outFile - File object for output Parameters: permissions - permissions for the output file Parameters: vs - substitutor which is used during copying Parameters: type - file type for the substitutor exception: IOException - if an I/O error occurs |
copyToTempFile | public static File copyToTempFile(File template, String defaultExtension) throws IOException(Code) | | Creates a temp file with delete on exit rule. The extension is extracted from the template if
possible, else the default extension is used. The contents of template will be copied into
the temporary file.
Parameters: template - file to copy from and define file extension Parameters: defaultExtension - file extension if no is contained in template newly created and filled temporary file throws: IOException - |
copyToTempFile | public static File copyToTempFile(File template, String defaultExtension, VariableSubstitutor vss) throws IOException(Code) | | Creates a temp file with delete on exit rule. The extension is extracted from the template if
possible, else the default extension is used. The contents of template will be copied into
the temporary file. If the variable substitutor is not null, variables will be replaced
during copying.
Parameters: template - file to copy from and define file extension Parameters: defaultExtension - file extension if no is contained in template Parameters: vss - substitutor which is used during copying newly created and filled temporary file throws: IOException - |
copyToTempFile | public static File copyToTempFile(String template, String defaultExtension) throws IOException(Code) | | Creates a temp file with delete on exit rule. The extension is extracted from the template if
possible, else the default extension is used. The contents of template will be copied into
the temporary file.
Parameters: template - file to copy from and define file extension Parameters: defaultExtension - file extension if no is contained in template newly created and filled temporary file throws: IOException - |
existingParent | public static File existingParent(File path)(Code) | | Returns the first existing parent directory in a path
Parameters: path - path which should be scanned the first existing parent directory in a path |
getFreeSpace | public static long getFreeSpace(String path)(Code) | | Returns the free (disk) space for the given path. If it is not ascertainable -1 returns.
Parameters: path - path for which the free space should be detected the free space for the given path |
getPrimaryGroup | public static String getPrimaryGroup()(Code) | | Returns the primary group of the current user. This feature will be supported only on Unix.
On other systems null returns.
the primary group of the current user |
getenv | public static String getenv(String key)(Code) | | Returns the value of the environment variable given by key. This method is a work around for
VM versions which do not support getenv in an other way. At the first call all environment
variables will be loaded via an exec. On Windows keys are not case sensitive.
Parameters: key - variable name for which the value should be resolved the value of the environment variable given by key |
replaceString | public static String replaceString(String destination, String what, String with)(Code) | | Returns a string resulting from replacing all occurrences of what in this string with with.
In opposite to the String.replaceAll method this method do not use regular expression or
other methods which are only available in JRE 1.4 and later. This method was special made to
mask masked slashes to avert a conversion during path translation.
Parameters: destination - string for which the replacing should be performed Parameters: what - what string should be replaced Parameters: with - with what string what should be replaced a new String object if what was found in the given string, else the given string self |
supported | public static boolean supported(String method)(Code) | | Returns whether the given method will be supported with the given environment. Some methods
of this class are not supported on all operation systems.
Parameters: method - name of the method true if the method will be supported with the current enivronment else false throws: RuntimeException - if the given method name does not exist |
translatePath | public static String translatePath(String destination, VariableSubstitutor vs)(Code) | | Translates a relative path to a local system path.
Parameters: destination - The path to translate. The translated path. |
|
|