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.String
ESCAPED_NEWLINE
static java.lang.String
FILE_SEP
static java.lang.String
NEWLINE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
read(java.io.File file)
static java.lang.String
readIfExists(java.io.File file)
static java.lang.String
resolve(java.lang.String path, java.io.File parent)
Returns the absolute path for the given path.static void
write(java.io.File file, java.lang.String contents)
static void
write(java.io.File file, java.lang.String contents, boolean append)
static void
write(java.lang.String path, java.lang.String contents)
static void
write(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 usingparent
as its parent path. Ifparent
isnull
, 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
- whenpath
isnull
-
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
-
-