|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.vizzini.util.FileUtilities
public class FileUtilities
Provides convenience methods for working with files.
| Nested Class Summary | |
|---|---|
(package private) class |
FileUtilities.URLComparator
Provides an implementation of Comparator for URLs. |
| Field Summary | |
|---|---|
protected static String |
LINE_SEPARATOR
Line separator. |
| Method Summary | |
|---|---|
static FileUtilities |
getInstance()
Return the singleton instance. |
protected boolean |
isPrefixedWith(URL url,
List list)
Return true if the given URL is prefixed by any item in the given list. |
protected boolean |
isSuffixedWith(URL url,
List list)
Return true if the given URL is suffixed with any item in the given list. |
URL[] |
listDirectories(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes)
List all directories using the given parameters. |
URL[] |
listDirectories(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes,
boolean isRecursive)
List all directories using the given parameters. |
URL[] |
listFiles(String protocol,
String host,
String file)
List all files using the given parameters. |
URL[] |
listFiles(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes)
List all files using the given parameters. |
URL[] |
listFiles(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes,
boolean isRecursive)
List all files using the given parameters. |
URL[] |
listFiles(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes,
boolean isRecursive,
boolean isDirectoriesOnly)
List all files using the given parameters. |
URL[] |
listFiles(URL url)
Return a collection of URLs representing files at the given URL. |
protected boolean |
passes(URL url,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes)
Return true if the given URL passes the filter as specified by the other parameters. |
protected String |
read(BufferedReader reader)
Return the contents of the given reader. |
String |
readFile(InputStream inputStream)
Return the contents of the given input stream. |
String |
readFile(Reader reader)
Return the contents of the given reader. |
String |
readFile(String sFilepath)
Return the contents of the file at the given path. |
String |
readFile(URL url)
Return the contents of the file at the given URL. |
void |
writeFile(File file,
String content)
Write the given string to the given file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String LINE_SEPARATOR
| Method Detail |
|---|
public static FileUtilities getInstance()
public URL[] listDirectories(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes)
throws MalformedURLException
protocol - Protocol (e.g. http or file).host - Host.file - File.includePrefixes - List of included prefixes (ignored if null).includeSuffixes - List of included suffixes (ignored if null).excludePrefixes - List of excluded prefixes (ignored if null).excludeSuffixes - List of excluded suffixes (ignored if null).
MalformedURLException
public URL[] listDirectories(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes,
boolean isRecursive)
throws MalformedURLException
protocol - Protocol (e.g. http or file).host - Host.file - File.includePrefixes - List of included prefixes (ignored if null).includeSuffixes - List of included suffixes (ignored if null).excludePrefixes - List of excluded prefixes (ignored if null).excludeSuffixes - List of excluded suffixes (ignored if null).isRecursive - Flag indicating whether to recursively include
subdirectories.
MalformedURLException
public URL[] listFiles(URL url)
throws IOException
url - Parent directory of the files to list.
IOException
public URL[] listFiles(String protocol,
String host,
String file)
throws MalformedURLException
protocol - Protocol (e.g. http or file).host - Host.file - File.
MalformedURLException
public URL[] listFiles(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes)
throws MalformedURLException
protocol - Protocol (e.g. http or file).host - Host.file - File.includePrefixes - List of included prefixes (ignored if null).includeSuffixes - List of included suffixes (ignored if null).excludePrefixes - List of excluded prefixes (ignored if null).excludeSuffixes - List of excluded suffixes (ignored if null).
MalformedURLException
public URL[] listFiles(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes,
boolean isRecursive)
throws MalformedURLException
protocol - Protocol (e.g. http or file).host - Host.file - File.includePrefixes - List of included prefixes (ignored if null).includeSuffixes - List of included suffixes (ignored if null).excludePrefixes - List of excluded prefixes (ignored if null).excludeSuffixes - List of excluded suffixes (ignored if null).isRecursive - Flag indicating whether to recursively include
subdirectories.
MalformedURLException
public URL[] listFiles(String protocol,
String host,
String file,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes,
boolean isRecursive,
boolean isDirectoriesOnly)
throws MalformedURLException
protocol - Protocol (e.g. http or file).host - Host.file - File.includePrefixes - List of included prefixes (ignored if null).includeSuffixes - List of included suffixes (ignored if null).excludePrefixes - List of excluded prefixes (ignored if null).excludeSuffixes - List of excluded suffixes (ignored if null).isRecursive - Flag indicating whether to recursively include
subdirectories.isDirectoriesOnly - Flag indicating whether to include directories
only.
MalformedURLException
public String readFile(Reader reader)
throws IOException
reader - Reader.
IOException
public String readFile(InputStream inputStream)
throws IOException
inputStream - Input stream.
IOException
public String readFile(String sFilepath)
throws FileNotFoundException,
IOException
sFilepath - Path to the file.
FileNotFoundException
IOException
public String readFile(URL url)
throws IOException
url - URL of the file.
IOException
public void writeFile(File file,
String content)
throws IOException
file - File to which to write.content - Content to put into the file.
IOException
protected boolean isPrefixedWith(URL url,
List list)
list - List of prefixes.url - URL.
protected boolean isSuffixedWith(URL url,
List list)
list - List of suffixes.url - URL.
protected boolean passes(URL url,
List includePrefixes,
List includeSuffixes,
List excludePrefixes,
List excludeSuffixes)
url - URL.includePrefixes - List of included prefixes (ignored if null).includeSuffixes - List of included suffixes (ignored if null).excludePrefixes - List of excluded prefixes (ignored if null).excludeSuffixes - List of excluded suffixes (ignored if null).
protected String read(BufferedReader reader)
throws IOException
reader - Buffered reader.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |