|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.util.file.Files
public class Files
File utility methods.
Method Summary | |
---|---|
static String |
basePath(String path,
String extension)
Strips off the given extension (probably returned from Files.extension()) from the path, yielding a base pathname. |
static String |
cleanupFilename(String filename)
Replaces commonly unsupported characters with '_' |
static void |
copy(File sourceFile,
File targetFile)
make a copy of a file |
static String |
extension(String path)
Gets extension from path |
static String |
filename(String path)
Gets filename from path |
static Time |
getLastModified(File file)
get last modification timestamp for file |
static File |
getLocalFileFromUrl(String url)
for urls that point to local files (e.g. |
static File |
getLocalFileFromUrl(URL url)
for urls that point to local files (e.g. |
static byte[] |
readBytes(File file)
read binary file fully |
static boolean |
remove(File file)
Deletes a file, dealing with a particularly nasty bug on Windows. |
static int |
writeTo(File file,
InputStream input)
Writes the given input stream to the given file |
static int |
writeTo(File file,
InputStream input,
int bufSize)
Writes the given input stream to the given file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String basePath(String path, String extension)
path
- The path, possibly with an extension to stripextension
- The extension to strip, or null if no extension exists
public static String extension(String path)
path
- The path
public static String filename(String path)
path
- The path
public static boolean remove(File file)
file
- File to delete
public static final int writeTo(File file, InputStream input) throws IOException
file
- The file to write toinput
- The input
IOException
public static byte[] readBytes(File file) throws IOException
file
- file to read
IOException
- is something went wrongpublic static final int writeTo(File file, InputStream input, int bufSize) throws IOException
file
- The file to write toinput
- The inputbufSize
- The memory buffer size. 4096 is a good value.
IOException
public static final String cleanupFilename(String filename)
Replaces commonly unsupported characters with '_'
filename
- to be cleaned
public static void copy(File sourceFile, File targetFile) throws IOException
sourceFile
- source file that needs to be clonedtargetFile
- target file that should be a duplicate of source file
IOException
- if something went wrongpublic static File getLocalFileFromUrl(URL url)
url
- url of the resource
null
otherwisegetLocalFileFromUrl(String)
public static File getLocalFileFromUrl(String url)
url
- url of the resource
null
otherwisegetLocalFileFromUrl(URL)
public static Time getLastModified(File file)
file
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |