public final class FileObjectUtils
extends java.lang.Object
FileObject.| Modifier | Constructor and Description |
|---|---|
private |
FileObjectUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
exists(FileObject fileObject)
Null-safe call to
FileObject.exists(). |
static AbstractFileObject |
getAbstractFileObject(FileObject fileObject)
Gets access to the base object even if decorated.
|
static java.lang.String |
getContentAsString(FileObject file,
java.nio.charset.Charset charset)
Returns the content of a file as a String.
|
static java.lang.String |
getContentAsString(FileObject file,
java.lang.String charset)
Returns the content of a file as a String.
|
static boolean |
isInstanceOf(FileObject fileObject,
java.lang.Class<?> wantedClass)
Checks if the given FileObject is instance of given class argument.
|
static java.util.Properties |
readProperties(FileObject fileObject)
Reads the given file into a new
Properties. |
static java.util.Properties |
readProperties(FileObject fileObject,
java.util.Properties properties)
Reads the given file into a new given
Properties. |
public static boolean exists(FileObject fileObject) throws FileSystemException
FileObject.exists().fileObject - the file object to test, may be null.fileObject is null, otherwise, see FileObject.exists().FileSystemException - On error determining if this file exists.public static AbstractFileObject getAbstractFileObject(FileObject fileObject) throws FileSystemException
fileObject - The FileObject.FileSystemException - if an error occurs.public static java.lang.String getContentAsString(FileObject file, java.nio.charset.Charset charset) throws java.io.IOException
file - The file to get the content of.charset - The file character set, may be null.java.io.IOException - if the file content cannot be accessed.public static java.lang.String getContentAsString(FileObject file, java.lang.String charset) throws java.io.IOException
file - The file to get the content of.charset - The file character set, may be null.java.io.IOException - if the file content cannot be accessed.public static boolean isInstanceOf(FileObject fileObject, java.lang.Class<?> wantedClass) throws FileSystemException
fileObject - The FileObject.wantedClass - The Class to check.FileSystemException - if an error occurs.public static java.util.Properties readProperties(FileObject fileObject) throws FileSystemException, java.io.IOException
Properties.fileObject - the file to readProperties.java.io.IOException - On error getting this file's content.FileSystemException - On error getting this file's content.java.io.IOException - On error getting this file's content.public static java.util.Properties readProperties(FileObject fileObject, java.util.Properties properties) throws FileSystemException, java.io.IOException
Properties.fileObject - the file to readproperties - the destinationProperties.FileSystemException - On error getting this file's content.java.io.IOException - On error getting this file's content.