|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wso2.carbon.server.util.FileUtils
public class FileUtils
taken from the commons file utils class. we didnt want to use the library. hence copied the source
| Constructor Summary | |
|---|---|
FileUtils()
|
|
| Method Summary | |
|---|---|
static void |
closeQuietly(InputStream input)
Unconditionally close an InputStream. |
static void |
closeQuietly(OutputStream output)
Unconditionally close an OutputStream. |
static int |
copy(InputStream input,
OutputStream output)
Copy bytes from an InputStream to an
OutputStream. |
static void |
copyDirectory(File srcDir,
File destDir)
Copies a whole directory to a new location preserving the file dates. |
static void |
copyDirectory(File srcDir,
File destDir,
boolean preserveFileDate)
Copies a whole directory to a new location. |
static void |
copyFile(File srcFile,
File destFile,
boolean preserveFileDate)
Copy file method. |
static boolean |
deleteDir(File dir)
Deletes all files and subdirectories under dir. |
static File |
getFile(File parentFile,
String fileName)
|
static Map<String,String> |
readJarsWithMD5(BufferedReader bufferedReader)
|
static List<String> |
readLinesToList(BufferedReader bufferedReader)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileUtils()
| Method Detail |
|---|
public static void copyDirectory(File srcDir,
File destDir)
throws IOException
srcDir - an existing directory to copy, must not be nulldestDir - the new directory, must not be null
NullPointerException - if source or destination is null
IOException - if source or destination is invalid
public static void copyDirectory(File srcDir,
File destDir,
boolean preserveFileDate)
throws IOException
srcDir - an existing directory to copy, must not be nulldestDir - the new directory, must not be nullpreserveFileDate - true if the file date of the copy
should be the same as the original
NullPointerException - if source or destination is null
IOException - if source or destination is invalid
public static void copyFile(File srcFile,
File destFile,
boolean preserveFileDate)
throws IOException
srcFile - the validated source file, not nulldestFile - the validated destination file, not nullpreserveFileDate - whether to preserve the file date
IOException - if an error occurspublic static void closeQuietly(OutputStream output)
OutputStream.
Equivalent to OutputStream.close(), except any exceptions will be ignored.
This is typically used in finally blocks.
output - the OutputStream to close, may be null or already closedpublic static void closeQuietly(InputStream input)
InputStream.
Equivalent to InputStream.close(), except any exceptions will be ignored.
This is typically used in finally blocks.
input - the InputStream to close, may be null or already closed
public static int copy(InputStream input,
OutputStream output)
throws IOException
InputStream to an
OutputStream.
This method buffers the input internally, so there is no need to use a
BufferedInputStream.
input - the InputStream to read fromoutput - the OutputStream to write to
NullPointerException - if the input or output is null
IOException - if an I/O error occurspublic static boolean deleteDir(File dir)
dir - The directory to be deleted
public static File getFile(File parentFile,
String fileName)
public static List<String> readLinesToList(BufferedReader bufferedReader)
throws IOException
IOException
public static Map<String,String> readJarsWithMD5(BufferedReader bufferedReader)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||