public class FileUtils extends Object
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
exists(String file) |
static String |
getFileURI(String fileName)
Creates a URI from a given file name.
|
static Collection<String> |
getFileURIs(String... fileNameList)
Creates a collection of URIs from a given list of files.
|
static Collection<String> |
getFileURIsFromRegex(String... fileNameRegexList)
Creates a collection of URIs from a given regex list.
|
static String |
readAll(Reader reader) |
static String |
readFile(File file) |
static String |
readFile(String fileName) |
static String |
readURL(URL fileURL) |
static String |
toURI(String fileName) |
public static boolean exists(String file)
public static String readURL(URL fileURL) throws IOException
IOExceptionpublic static String readFile(File file) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static String readFile(String fileName) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static String readAll(Reader reader) throws IOException
IOExceptionpublic static Collection<String> getFileURIsFromRegex(String... fileNameRegexList)
Creates a collection of URIs from a given regex list. The given list can contain either absolute (local or remote) URIs or a Java regex expression for a local path. If a regex is given all the files whose name matches the regex will be added to the resulting list.
The regular expressions supported by this function are Java regular
expressions. If we want to get the URIS for all the files in a directory
we need to pass /path/to/dir/.*
fileNameRegexList - list of regular expressions for fiel URIspublic static Collection<String> getFileURIs(String... fileNameList)
fileNameList - the list of filesCopyright © 2019. All rights reserved.