org.mindswap.pellet.utils
Class FileUtils
java.lang.Object
org.mindswap.pellet.utils.FileUtils
public class FileUtils
- extends java.lang.Object
|
Method Summary |
static boolean |
exists(java.lang.String file)
|
static java.util.Collection<java.lang.String> |
getFileURIs(java.lang.String... fileNameRegexList)
Creates a collection of URIs from a given regex list. |
static java.lang.String |
readAll(java.io.Reader reader)
|
static java.lang.String |
readFile(java.io.File file)
|
static java.lang.String |
readFile(java.lang.String fileName)
|
static java.lang.String |
readURL(java.net.URL fileURL)
|
static java.lang.String |
toURI(java.lang.String fileName)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileUtils
public FileUtils()
exists
public static boolean exists(java.lang.String file)
readURL
public static java.lang.String readURL(java.net.URL fileURL)
throws java.io.IOException
- Throws:
java.io.IOException
readFile
public static java.lang.String readFile(java.io.File file)
throws java.io.FileNotFoundException,
java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
readFile
public static java.lang.String readFile(java.lang.String fileName)
throws java.io.FileNotFoundException,
java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
readAll
public static java.lang.String readAll(java.io.Reader reader)
throws java.io.IOException
- Throws:
java.io.IOException
toURI
public static java.lang.String toURI(java.lang.String fileName)
getFileURIs
public static java.util.Collection<java.lang.String> getFileURIs(java.lang.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/.*
- Parameters:
fileNameRegexList - list of regular expressions for fiel URIs
- Returns:
- list of file URIs matching the given regular expressions
Copyright © 2004 Evren Sirin. All Rights Reserved.