|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensubsystems.core.util.FileUtils
public class FileUtils
Collection of methods to make work with files easier.
| Field Summary | |
|---|---|
static int |
BUFFER_SIZE
How big buffer to use to process files. |
static int[] |
DEFAULT_STRORAGE_TREE_DISTRIBUTION
Default 10 digit file storage distribution array. |
protected static java.lang.String |
s_strTempDirectory
Temporary directory to use. |
static java.lang.String |
TEMPORARY_DIRECTORY_PATH
Specifies what directory should be used to store generated and other temporary files and directories. |
static java.lang.String |
TEMPORARY_DIRECTORY_PATH_DEFAULT
The default directory where temporary files should be created. |
| Constructor Summary | |
|---|---|
FileUtils()
|
|
| Method Summary | |
|---|---|
static void |
copyFile(java.io.File flCurrent,
java.io.File flDestination)
Copy the current file to the destination file. |
static void |
copyStreamToFile(java.io.InputStream input,
java.io.File output)
Copy any input stream to output file. |
static void |
copyStreamToStream(java.io.InputStream input,
java.io.OutputStream output)
Copy any input stream to output stream. |
static java.lang.String |
createTemporarySubdirectory(java.lang.String strPrefix,
java.lang.String strTemporarySubDirID,
boolean bUseSession)
Method constructs and returns repository path. |
static boolean |
deleteDir(java.io.File fDir)
Deletes all files and subdirectories under the specified directory including the specified directory |
static boolean |
deleteDir(java.lang.String strDir)
Deletes all files and subdirectories under the specified directory including the specified directory |
static boolean |
deleteDirectoryContent(java.io.File fDir)
Delete all files and directories in directory but do not delete the directory itself. |
static boolean |
deleteDirectoryContent(java.lang.String strDir)
Delete all files and directories in directory but do not delete the directory itself. |
static TwoObjectStruct |
getFilenameSplit(java.lang.String filePath)
Function will create TwoObjectStruct from full file path and name string |
static java.lang.String |
getFileStoragePath(long lID,
java.lang.String rootDirPath,
java.lang.String idExtension,
java.lang.String fileExtension)
Function converts parameters to full path and name in tree file storage using the default tree schema. |
static java.lang.String |
getFileStoragePath(long lID,
java.lang.String rootDirPath,
java.lang.String idExtension,
java.lang.String fileExtension,
int[] treeDistribution)
Function converts parameters to full path and name in tree file storage. |
static java.lang.String |
getTemporaryDirectory()
Get path which represents temporary directory. |
boolean |
isFileBinaryEqual(java.io.File first,
java.io.File second)
Compare binary files. |
static java.util.List |
listFiles(java.io.File directory,
int maximum,
java.util.Date olderThan)
Create list of files in directory. |
static void |
moveFile(java.io.File flCurrent,
java.io.File flDestination)
Move file to a new location. |
static void |
moveFile(java.io.File flCurrent,
java.lang.String strNewName)
Move file to a new location. |
static void |
renameToTemporaryName(java.io.File flFileToRename,
java.lang.String strPrefix)
Rename the file to temporaty name with given prefix |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String TEMPORARY_DIRECTORY_PATH
public static final java.lang.String TEMPORARY_DIRECTORY_PATH_DEFAULT
public static final int[] DEFAULT_STRORAGE_TREE_DISTRIBUTION
public static final int BUFFER_SIZE
protected static java.lang.String s_strTempDirectory
| Constructor Detail |
|---|
public FileUtils()
| Method Detail |
|---|
public static void moveFile(java.io.File flCurrent,
java.lang.String strNewName)
throws java.io.IOException,
OSSException
flCurrent - - file to movestrNewName - - new location including file name
java.io.IOException - - error message
OSSException - - error message
public static void moveFile(java.io.File flCurrent,
java.io.File flDestination)
throws java.io.IOException,
OSSException
flCurrent - - file to moveflDestination - - destination file
java.io.IOException - - error message
OSSException - - error message
public static void copyFile(java.io.File flCurrent,
java.io.File flDestination)
throws java.io.IOException,
OSSException
flCurrent - - source fileflDestination - - destination file
java.io.IOException - - error message
OSSException - - error message
public static void renameToTemporaryName(java.io.File flFileToRename,
java.lang.String strPrefix)
throws java.io.IOException
flFileToRename - - file to renamestrPrefix - - prefix to use
java.io.IOException - - error messagepublic static boolean deleteDirectoryContent(java.lang.String strDir)
strDir - - string that specifies directory to delete
public static boolean deleteDirectoryContent(java.io.File fDir)
fDir - - directory to delete
public static boolean deleteDir(java.lang.String strDir)
strDir - - string that specifies directory to be deleted
public static boolean deleteDir(java.io.File fDir)
fDir - - directory to be deleted
public boolean isFileBinaryEqual(java.io.File first,
java.io.File second)
throws java.io.IOException
first - - first filesecond - - second file
java.io.IOException - - error in function
public static java.util.List listFiles(java.io.File directory,
int maximum,
java.util.Date olderThan)
directory - - File with directorymaximum - - maximum size of output listolderThan - - file last modification time heve to by before this date
public static java.lang.String getFileStoragePath(long lID,
java.lang.String rootDirPath,
java.lang.String idExtension,
java.lang.String fileExtension)
lID - - id (decimal number) part of file namerootDirPath - - root directory for file storage treeidExtension - - extension after id part of name and before file extension
can be empty or nullfileExtension - - file extension - with dot
public static java.lang.String getFileStoragePath(long lID,
java.lang.String rootDirPath,
java.lang.String idExtension,
java.lang.String fileExtension,
int[] treeDistribution)
lID - - id (decimal number) part of file namerootDirPath - - root directory for file storage tree path. It have to end with
separator charidExtension - - extension after id part of name and before file extension
can be empty or nullfileExtension - - file extension - with dottreeDistribution - - tree distribution array. arrai of int > 0.
public static TwoObjectStruct getFilenameSplit(java.lang.String filePath)
filePath - - file path and name
public static java.lang.String getTemporaryDirectory()
public static java.lang.String createTemporarySubdirectory(java.lang.String strPrefix,
java.lang.String strTemporarySubDirID,
boolean bUseSession)
throws java.io.IOException
strPrefix - - prefix to use to create directory namestrTemporarySubDirID - - string value used to create subdirectory
of the parent directorybUseSession - - if true then current session will be user as
part of unique parh
java.io.IOException - - error occured during creating of directory structure
public static void copyStreamToFile(java.io.InputStream input,
java.io.File output)
throws java.io.IOException,
OSSMultiException
input - - InputStream to copy fromoutput - - File to copy to
java.io.IOException - - error in function
OSSMultiException - - double error in function
public static void copyStreamToStream(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException,
OSSMultiException
input - - InputStream to copy fromoutput - - OutputStream to copy to
java.io.IOException - - io error in function
OSSMultiException - - double error in function
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||