|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.core.util.FileUtils
public class FileUtils
| Constructor Summary | |
|---|---|
FileUtils()
|
|
| Method Summary | |
|---|---|
static int |
copy(InputStream input,
OutputStream output)
Deprecated. since 3.18 use IOUtils.copy(InputStream, OutputStream) |
static int |
copy(InputStream input,
OutputStream output,
int bufferSize)
Deprecated. since 3.18 use IOUtils.copy(InputStream, OutputStream) |
static void |
copyDirectory(File srcDir,
File destDir)
Copies all files from srcDir to destDir. |
static void |
copyDirectory(File srcDir,
File destDir,
boolean overwrite)
|
static void |
copyFile(File srcFile,
File destFile)
Copy file from source to destination. |
static void |
copyFile(File srcFile,
File destFile,
boolean overwrite)
Copies a file to a new location, optionally overwriting an existing file in the new location. |
static void |
copyFile(InputStream srcStream,
File destFile)
Save an input stream to a file. |
static void |
copyFile(InputStream srcStream,
File destFile,
boolean overwrite)
Save an input stream to a file, optionally overwriting the file if is exists. |
static void |
createZipFile(File baseDir,
File zipFile)
Create a zip file of a given directory. |
static boolean |
deleteDir(File dir)
safely performs a recursive delete on a directory |
static void |
ensureFileAndPathExist(File file)
Check that a given file and its parent directories exist - will create blank file and all directories if necessary. |
static String |
getInputStreamTextContent(InputStream is)
Deprecated. since 3.18 use IOUtils.toString(InputStream, String) |
static String |
getResourceContent(javax.servlet.http.HttpServletRequest req,
String resource)
Get the contents of a servlet context resource as a String. |
static String |
getResourceContent(String resource)
Get the contents of a classpath resource as a String. |
static boolean |
moveDir(File dirName,
File destDir)
move a directory with all it's children into another directory if destination directory already exists, it will be deleted. |
static List |
readResourcesAsList(String resource)
Get the contents of a resource as a list, one line representing one list item. |
static void |
recursiveDelete(File file)
Recursively delete everything beneath file then delete dir. |
static void |
saveTextFile(String stringContent,
File destFile)
Writes text to the nominated file. |
static void |
shutdownStream(InputStream input)
Deprecated. since 3.18 use IOUtils.closeQuietly(OutputStream) |
static void |
shutdownStream(OutputStream output)
Deprecated. since 3.18 use IOUtils.closeQuietly(OutputStream) |
| 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 int copy(InputStream input,
OutputStream output)
throws IOException
IOUtils.copy(InputStream, OutputStream)
InputStream to an OutputStream.
input - the InputStream to read fromoutput - the OutputStream to write to
IOException - In case of an I/O problemIOUtils.copy(InputStream, OutputStream)
public static int copy(InputStream input,
OutputStream output,
int bufferSize)
throws IOException
IOUtils.copy(InputStream, OutputStream)
InputStream to an OutputStream.
input - the InputStream to read fromoutput - the OutputStream to write tobufferSize - ignored
IOException - In case of an I/O problemIOUtils.copy(InputStream, OutputStream)public static void shutdownStream(OutputStream output)
IOUtils.closeQuietly(OutputStream)
OutputStream.
Equivalent to OutputStream.close(), except any exceptions will be ignored.
output - A (possibly null) OutputStreamIOUtils.closeQuietly(OutputStream)public static void shutdownStream(InputStream input)
IOUtils.closeQuietly(OutputStream)
InputStream.
Equivalent to InputStream.close(), except any exceptions will be ignored.
input - A (possibly null) InputStreamIOUtils.closeQuietly(OutputStream)public static boolean deleteDir(File dir)
public static void recursiveDelete(File file)
public static String getResourceContent(String resource)
public static String getResourceContent(javax.servlet.http.HttpServletRequest req,
String resource)
public static String getInputStreamTextContent(InputStream is)
IOUtils.toString(InputStream, String)
IOUtils.toString(InputStream, String)
public static void saveTextFile(String stringContent,
File destFile)
throws IOException
IOException
public static void ensureFileAndPathExist(File file)
throws IOException
IOException
public static boolean moveDir(File dirName,
File destDir)
public static void createZipFile(File baseDir,
File zipFile)
throws Exception
Exceptionpublic static List readResourcesAsList(String resource)
public static void copyDirectory(File srcDir,
File destDir)
throws IOException
IOException
public static void copyDirectory(File srcDir,
File destDir,
boolean overwrite)
throws IOException
IOException
public static void copyFile(File srcFile,
File destFile)
throws IOException
destination will be
created if they don't already exist. destination will be overwritten if it
already exists.
srcFile - An existing non-directory File to copy bytes from.destFile - A non-directory File to write bytes to (possibly
overwriting).
IOException - if source does not exist, destination cannot be
written to, or an IO error occurs during copying.
public static void copyFile(File srcFile,
File destFile,
boolean overwrite)
throws IOException
srcFile - the file to copydestFile - the file to be saved, which can already exist if overwrite is setoverwrite - true if an existing file should be overwritten
IOException - if the source file does not exist, a problem occurs writing to the destination file,
or the destination file exists and is read-only
public static void copyFile(InputStream srcStream,
File destFile)
throws IOException
srcStream - the input stream to savedestFile - the file to be saved
IOException - if a problem occurs writing to the file, or the file exists and is read-only
public static void copyFile(InputStream srcStream,
File destFile,
boolean overwrite)
throws IOException
srcStream - the input stream to savedestFile - the file to be saved, which can already exist if overwrite is setoverwrite - true if an existing file should be overwritten
IOException - if a problem occurs writing to the file, or the file exists and is read-only
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||