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