public final class FileObjectUtils extends Object
FileObject.| 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 String |
getContentAsString(FileObject file,
Charset charset)
Returns the content of a file as a String.
|
static String |
getContentAsString(FileObject file,
String charset)
Returns the content of a file as a String.
|
static boolean |
isInstanceOf(FileObject fileObject,
Class<?> wantedClass)
Checks if the given FileObject is instance of given class argument.
|
static Properties |
readProperties(FileObject fileObject)
Reads the given file into a new
Properties. |
static Properties |
readProperties(FileObject fileObject,
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 String getContentAsString(FileObject file, Charset charset) throws IOException
file - The file to get the content of.charset - The file character set, may be null.IOException - if the file content cannot be accessed.public static String getContentAsString(FileObject file, String charset) throws IOException
file - The file to get the content of.charset - The file character set, may be null.IOException - if the file content cannot be accessed.public static boolean isInstanceOf(FileObject fileObject, Class<?> wantedClass) throws FileSystemException
fileObject - The FileObject.wantedClass - The Class to check.FileSystemException - if an error occurs.public static Properties readProperties(FileObject fileObject) throws FileSystemException, IOException
Properties.fileObject - the file to readProperties.IOException - On error getting this file's content.FileSystemException - On error getting this file's content.IOException - On error getting this file's content.public static Properties readProperties(FileObject fileObject, Properties properties) throws FileSystemException, IOException
Properties.fileObject - the file to readproperties - the destinationProperties.FileSystemException - On error getting this file's content.IOException - On error getting this file's content.Copyright © 2002–2019 The Apache Software Foundation. All rights reserved.