|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.pool.RecyclableSupport
org.norther.tammi.core.pool.PoolableSupport
org.norther.tammi.spray.engine.tool.GlobalTool
org.norther.tammi.spray.engine.tool.PathTool
public class PathTool
A global context tool for file path operations.
| Constructor Summary | |
|---|---|
PathTool()
Constructs a new tool. |
|
| Method Summary | |
|---|---|
boolean |
deleteFile(File file)
Deletes a file or folder and its contents. |
File |
findFile(String path)
Finds a file relative to the current root directory. |
File |
findFile(String key,
String path)
Finds a file relative to the specified key directory. |
File |
findFile(String key,
String path,
Locale locale)
Finds a localized file relative to the specified key directory. |
File |
findFile(String key,
String path,
Locale locale,
String variant)
Finds a localized file relative to the specified key directory. |
URL |
findResource(String path)
Finds a resource relative to the current root folder. |
URL |
findResource(String key,
String path)
Finds a resource relative to the specified key folder. |
URL |
findResource(String key,
String path,
Locale locale)
Finds a localized resource relative to the specified key folder. |
URL |
findResource(String key,
String path,
Locale locale,
String variant)
Finds a localized resource relative to the specified key folder. |
URL |
findURL(String path)
Finds a file or resource relative to the current root folder. |
URL |
findURL(String key,
String path)
Finds a file or resource relative to the specified key folder. |
URL |
findURL(String key,
String path,
Locale locale)
Finds a localized file or resource relative to the specified key folder. |
URL |
findURL(String key,
String path,
Locale locale,
String variant)
Finds a localized file or resource relative to the specified key folder. |
CharSequence |
read(File file,
String encoding)
Reads the contents of the specified file. |
CharSequence |
read(InputStream input,
String encoding)
Reads the contents of the specified stream. |
CharSequence |
read(URL url,
String encoding)
Reads the contents of the specified URL. |
Set |
sortByDate(File[] files)
Sorts an array of files based on their modification date. |
Set |
sortByName(File[] files)
Sorts an array of files based on their name. |
void |
write(File file,
CharSequence contents,
String encoding)
Writes the contents of the specified file. |
void |
write(OutputStream output,
CharSequence contents,
String encoding)
Writes the contents of the specified stream. |
| Methods inherited from class org.norther.tammi.spray.engine.tool.GlobalTool |
|---|
clone, dispose, getContext, getContextToolFilter, getMBeanServer, getName, isBound, nop, toString, valueBound, valueUnbound |
| Methods inherited from class org.norther.tammi.core.pool.PoolableSupport |
|---|
disposed, recycled |
| Methods inherited from class org.norther.tammi.core.pool.RecyclableSupport |
|---|
isDisposed, recycle |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.norther.tammi.core.pool.Recyclable |
|---|
isDisposed, recycle |
| Constructor Detail |
|---|
public PathTool()
| Method Detail |
|---|
public boolean deleteFile(File file)
file - the file to delete.
public URL findURL(String path)
path - the pathname of the file.
public URL findURL(String key,
String path)
key - a folder key.path - the pathname of the file.
public URL findURL(String key,
String path,
Locale locale)
key - a folder key.path - the pathname of the file.locale - the locale of the file.
public URL findURL(String key,
String path,
Locale locale,
String variant)
key - a folder key.path - the pathname of the file.locale - the locale of the file.variant - an optional locale variant.
public File findFile(String path)
path - the pathname of the file.
public File findFile(String key,
String path)
key - the directory key.path - the pathname of the file.
public File findFile(String key,
String path,
Locale locale)
key - the directory key.path - the pathname of the file.locale - the locale of the file.
public File findFile(String key,
String path,
Locale locale,
String variant)
key - the directory key.path - the pathname of the file.locale - the locale of the file.variant - an optional locale variant.
public URL findResource(String path)
path - the pathname of the file.
public URL findResource(String key,
String path)
key - a folder key.path - the pathname of the file.
public URL findResource(String key,
String path,
Locale locale)
key - a folder key.path - the pathname of the file.locale - the locale of the file.
public URL findResource(String key,
String path,
Locale locale,
String variant)
key - a folder key.path - the pathname of the file.locale - the locale of the file.variant - an optional locale variant.
public Set sortByName(File[] files)
files - an array of files.
public Set sortByDate(File[] files)
files - an array of files.
public CharSequence read(File file,
String encoding)
file - the file.encoding - the encoding.
public CharSequence read(URL url,
String encoding)
url - the URL.encoding - the encoding.
public CharSequence read(InputStream input,
String encoding)
input - the stream.encoding - the encoding.
public void write(File file,
CharSequence contents,
String encoding)
file - the file.contents - the contents.encoding - the encoding.
public void write(OutputStream output,
CharSequence contents,
String encoding)
output - the stream.contents - the contents.encoding - the encoding.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||