public abstract class FileUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ESCAPED_NEWLINE |
static String |
FILE_SEP |
static String |
NEWLINE |
Modifier and Type | Method and Description |
---|---|
static String |
read(File file) |
static String |
readIfExists(File file) |
static String |
resolve(String path,
File parent)
Returns the absolute path for the given path.
|
static void |
write(File file,
String contents) |
static void |
write(File file,
String contents,
boolean append) |
static void |
write(String path,
String contents) |
static void |
write(String path,
String contents,
boolean append) |
public static final String FILE_SEP
public static final String NEWLINE
public static final String ESCAPED_NEWLINE
public static String resolve(String path, File parent)
parent
as its parent path. If parent
is
null
, the path is resolved using the default relative
path (typically the directory from which the JVM was launched).path
- a relative or absolute path.parent
- the parent directory to use when resolving a
relative path.NullPointerException
- when path
is
null
public static String readIfExists(File file) throws IOException
IOException
public static String read(File file) throws IOException
IOException
public static void write(String path, String contents) throws IOException
IOException
public static void write(String path, String contents, boolean append) throws IOException
IOException
public static void write(File file, String contents) throws IOException
IOException
public static void write(File file, String contents, boolean append) throws IOException
IOException
Copyright © 2018. All rights reserved.