|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.util.FileUtil
public class FileUtil
Some convenient file methods.
| Constructor Summary | |
|---|---|
FileUtil()
|
|
| Method Summary | |
|---|---|
static void |
copyTo(java.io.File src,
java.io.File dest)
Copy a file. |
static java.io.File |
copyToDir(java.io.File src,
java.io.File dir)
Copy file to directory |
static void |
deleteDir(java.io.File dir)
Deletes the passed direcory and all its subdirectories (and so on). |
static void |
deleteDir(java.lang.String dirPath)
Deletes the direcory with the given path. |
static byte[] |
getBytesFromStream(java.io.InputStream is)
|
static java.lang.String |
getContent(java.io.File file)
Get the content of a file as string. |
static java.io.File |
getFileFromPath(java.lang.String path)
Get a file object from a pathname. |
static java.lang.String |
getMimeType(java.lang.String ext)
Return the mime-type from the extension. |
static java.lang.String |
getNoComment(java.io.InputStream in)
|
static java.lang.String |
getNoComment(java.io.Reader in)
Get the contents of an input stream without the comments. |
static java.lang.String |
getNoCommentContent(java.lang.String filename)
|
static java.util.List |
listFiles(java.lang.String namePattern,
java.io.File dir)
List file with name specified with wildcard in directory and all its subdirectories. |
static java.lang.String |
loadResource(java.lang.String resource)
Load a resource as string from the classpath. |
static byte[] |
loadResourceBytes(java.lang.String resource)
|
static byte[] |
loadResourceBytes(java.net.URL url)
Load a resource as byte array from the classpath. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileUtil()
| Method Detail |
|---|
public static java.lang.String getMimeType(java.lang.String ext)
ext - the extension, for example "doc" or "html"
public static java.lang.String loadResource(java.lang.String resource)
throws ApplicationException
resource - a path to a resource
ApplicationException
public static byte[] loadResourceBytes(java.net.URL url)
throws ApplicationException
url - the url of a resource
ApplicationException
public static byte[] loadResourceBytes(java.lang.String resource)
throws ApplicationException
ApplicationException
public static byte[] getBytesFromStream(java.io.InputStream is)
throws ApplicationException
ApplicationException
public static void copyTo(java.io.File src,
java.io.File dest)
throws java.io.FileNotFoundException,
java.io.IOException
src - the source filedest - the destination file
java.io.FileNotFoundException
java.io.IOException
public static java.io.File copyToDir(java.io.File src,
java.io.File dir)
throws java.io.FileNotFoundException,
java.io.IOException
src - dir -
java.io.FileNotFoundException
java.io.IOException
public static java.lang.String getContent(java.io.File file)
throws java.io.IOException
file - the file
java.io.IOException
public static java.lang.String getNoComment(java.io.InputStream in)
throws java.lang.Exception
java.lang.Exception
public static java.lang.String getNoComment(java.io.Reader in)
throws java.lang.Exception
in - the input stream
java.lang.Exception
public static java.lang.String getNoCommentContent(java.lang.String filename)
throws java.lang.Exception
java.lang.Exceptionpublic static void deleteDir(java.lang.String dirPath)
dirPath - the directory pathpublic static void deleteDir(java.io.File dir)
dir - the directorypublic static java.io.File getFileFromPath(java.lang.String path)
path - the path string
public static java.util.List listFiles(java.lang.String namePattern,
java.io.File dir)
namePattern - dir -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||