|
|||||||||||
| 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)
Copy bytes from an InputStream to an OutputStream. |
static int |
copy(java.io.InputStream input,
java.io.OutputStream output,
int bufferSize)
Copy bytes from an InputStream to an 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)
|
static void |
copyFile(java.io.InputStream srcStream,
java.io.File destFile)
|
static void |
copyFile(java.io.InputStream srcStream,
java.io.File destFile,
boolean overwrite)
|
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)
Get the contents of an inputstream as a 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)
Unconditionally close an InputStream. |
static void |
shutdownStream(java.io.OutputStream output)
Unconditionally close an 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
InputStream to an OutputStream.
input - the InputStream to read fromoutput - the OutputStream to write to
java.io.IOException - In case of an I/O problem
public static int copy(java.io.InputStream input,
java.io.OutputStream output,
int bufferSize)
throws java.io.IOException
InputStream to an OutputStream.
input - the InputStream to read fromoutput - the OutputStream to write tobufferSize - Size of internal buffer to use.
java.io.IOException - In case of an I/O problempublic static void shutdownStream(java.io.OutputStream output)
OutputStream.
Equivalent to OutputStream.close(), except any exceptions will be ignored.
output - A (possibly null) OutputStreampublic static void shutdownStream(java.io.InputStream input)
InputStream.
Equivalent to InputStream.close(), except any exceptions will be ignored.
input - A (possibly null) InputStreampublic static boolean deleteDir(java.io.File dir)
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)
public static void saveTextFile(java.lang.String stringContent,
java.io.File destFile)
throws java.io.IOException
stringContent - destFile -
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)
dirName - 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
java.io.IOException
public static void copyFile(java.io.InputStream srcStream,
java.io.File destFile)
throws java.io.IOException
java.io.IOException
public static void copyFile(java.io.InputStream srcStream,
java.io.File destFile,
boolean overwrite)
throws java.io.IOException
java.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||