org.red5.server.util
public class FileUtil extends Object
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
copy(InputStream in,
OutputStream out) |
static void |
copyFile(File source,
File dest) |
static void |
copyFile(String source,
String dest) |
static boolean |
deleteDirectory(String directory)
Deletes a directory and its contents.
|
static boolean |
deleteDirectory(String directory,
boolean useOSNativeDelete)
Deletes a directory and its contents.
|
static String |
formatPath(String absWebappsPath,
String contextDirName)
Quick-n-dirty directory formatting to support launching in windows, specifically from ant.
|
static String |
generateCustomName()
Generates a custom name containing numbers and an underscore ex.
|
static boolean |
makeDirectory(String directory)
Create a directory.
|
static boolean |
makeDirectory(String directory,
boolean createParents)
Create a directory.
|
static void |
moveFile(String source,
String dest) |
static byte[] |
readAsByteArray(File localSwfFile)
Reads all the bytes of a given file into an array.
|
static void |
rename(String from,
String to)
Rename a file natively; using REN on Windows and mv on *nix.
|
static void |
unzip(String compressedFileName,
String destinationDir)
Unzips a war file to an application located under the webapps directory
|
public static void copyFile(File source, File dest) throws IOException
IOException
public static void copyFile(String source, String dest) throws IOException
IOException
public static void moveFile(String source, String dest) throws IOException
IOException
public static boolean deleteDirectory(String directory) throws IOException
directory
- directory to deleteIOException
- if directory cannot be deletedpublic static boolean deleteDirectory(String directory, boolean useOSNativeDelete) throws IOException
directory
- directory to deleteuseOSNativeDelete
- flag to signify use of operating system delete functionIOException
- if directory cannot be deletedpublic static void rename(String from, String to)
from
- old nameto
- new namepublic static boolean makeDirectory(String directory) throws IOException
directory
- directory to makeIOException
- if directory does not already exist or cannot be madepublic static boolean makeDirectory(String directory, boolean createParents) throws IOException
directory
- directorycreateParents
- whether to create all parentsIOException
- if we cannot create directorypublic static void unzip(String compressedFileName, String destinationDir)
compressedFileName
- The String name of the war filedestinationDir
- The destination directory, ie: webappspublic static void copy(InputStream in, OutputStream out) throws IOException
IOException
public static String formatPath(String absWebappsPath, String contextDirName)
absWebappsPath
- abs webapps pathcontextDirName
- conext directory namepublic static String generateCustomName()
public static byte[] readAsByteArray(File localSwfFile)
localSwfFile
- Copyright © 2006-2012 The Red5 Project