Package org.eclipse.epsilon.egl.util
Class FileUtil
- java.lang.Object
-
- org.eclipse.epsilon.egl.util.FileUtil
-
public abstract class FileUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringESCAPED_NEWLINEstatic java.lang.StringFILE_SEPstatic java.lang.StringNEWLINE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringread(java.io.File file)static java.lang.StringreadIfExists(java.io.File file)static java.lang.Stringresolve(java.lang.String path, java.io.File parent)Returns the absolute path for the given path.static voidwrite(java.io.File file, java.lang.String contents)static voidwrite(java.io.File file, java.lang.String contents, boolean append)static voidwrite(java.lang.String path, java.lang.String contents)static voidwrite(java.lang.String path, java.lang.String contents, boolean append)
-
-
-
Method Detail
-
resolve
public static java.lang.String resolve(java.lang.String path, java.io.File parent)Returns the absolute path for the given path. The given path may be relative, in which case it is resolved usingparentas its parent path. Ifparentisnull, the path is resolved using the default relative path (typically the directory from which the JVM was launched).- Parameters:
path- a relative or absolute path.parent- the parent directory to use when resolving a relative path.- Returns:
- The absolute path for the given path.
- Throws:
java.lang.NullPointerException- whenpathisnull
-
readIfExists
public static java.lang.String readIfExists(java.io.File file) throws java.io.IOException- Returns:
- null if the file doesn't exist
- Throws:
java.io.IOException
-
read
public static java.lang.String read(java.io.File file) throws java.io.IOException- Throws:
java.io.IOException
-
write
public static void write(java.lang.String path, java.lang.String contents) throws java.io.IOException- Throws:
java.io.IOException
-
write
public static void write(java.lang.String path, java.lang.String contents, boolean append) throws java.io.IOException- Throws:
java.io.IOException
-
write
public static void write(java.io.File file, java.lang.String contents) throws java.io.IOException- Throws:
java.io.IOException
-
write
public static void write(java.io.File file, java.lang.String contents, boolean append) throws java.io.IOException- Throws:
java.io.IOException
-
-