Class FileUtils
java.lang.Object
com.ibm.wsspi.kernel.service.utils.FileUtils
A set of utilities for working with Files
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanensureDirExists(File dir) static booleanfileCanRead(File target) Execute theFile.canRead()from within aPrivilegedAction.static booleanfileCanWrite(File target) Execute theFile.canWrite()from within aPrivilegedAction.static BooleanfileCreate(File target) CallsFile.createNewFile()on the specifiedtargetstatic booleanfileDelete(File file) Delete filestatic booleanfileExists(File target) Execute theFile.exists()from within aPrivilegedAction.static booleanfileIsDirectory(File target) Execute theFile.isDirectory()from within aPrivilegedAction.static booleanfileIsFile(File target) Execute theFile.isFile()from within aPrivilegedAction.static longfileLastModified(File target) Execute theFile.lastModified()from within aPrivilegedAction.static longfileLength(File target) Execute theFile.length()from within aPrivilegedAction.static booleanstatic booleanfileMkDirs(File target) static FileOutputStreamgetFileOutputStream(File target) Create a newFileOutputStreamfor the file within aPrivilegedAction.static InputStreamgetInputStream(File target) Create a newInputStreamfor the file within aPrivilegedAction.static String[]Execute theFile.list()from within aPrivilegedAction.static File[]Execute theFile.listFiles()from within aPrivilegedAction.static booleansetUserReadWriteOnly(File file) Set the file permissions of the file to be user rw only.static booleantryToClose(Closeable closeable) Close the closeable object
- 
Constructor Details- 
FileUtilspublic FileUtils()
 
- 
- 
Method Details- 
fileIsFileExecute theFile.isFile()from within aPrivilegedAction.- Parameters:
- f-
- Returns:
 
- 
fileIsDirectoryExecute theFile.isDirectory()from within aPrivilegedAction.- Parameters:
- f-
- Returns:
 
- 
fileExistsExecute theFile.exists()from within aPrivilegedAction.- Parameters:
- target-
- Returns:
 
- 
fileLengthExecute theFile.length()from within aPrivilegedAction.- Parameters:
- target-
- Returns:
 
- 
listFilesExecute theFile.listFiles()from within aPrivilegedAction.- Parameters:
- f-
- Returns:
 
- 
listExecute theFile.list()from within aPrivilegedAction.- Parameters:
- f-
- Returns:
 
- 
getInputStreamCreate a newInputStreamfor the file within aPrivilegedAction.- Throws:
- FileNotFoundException
 
- 
getFileOutputStreamCreate a newFileOutputStreamfor the file within aPrivilegedAction.- Throws:
- FileNotFoundException
 
- 
fileLastModifiedExecute theFile.lastModified()from within aPrivilegedAction.- Parameters:
- target- The file to get the last modified for
- Returns:
- The last modified for the file
 
- 
fileCanReadExecute theFile.canRead()from within aPrivilegedAction.- Parameters:
- target- The file to test if it can be read
- Returns:
- trueif the file can be read
 
- 
fileCanWriteExecute theFile.canWrite()from within aPrivilegedAction.- Parameters:
- target- The file to test if it can be written
- Returns:
- trueif the file can be written
 
- 
fileMkDirs- Parameters:
- target- The tarket to make a directory for
- Returns:
- trueif this succeeded.
 
- 
fileMkDir- Parameters:
- target- The tarket to make a directory for
- Returns:
- trueif this succeeded.
 
- 
fileDeleteDelete file- Returns:
- trueif file was deleted
 
- 
ensureDirExists- Parameters:
- target- The target to check for existence or to create if it doesn't exist
- Returns:
- trueif either call succeeded.
 
- 
tryToCloseClose the closeable object- Parameters:
- closeable-
 
- 
setUserReadWriteOnlySet the file permissions of the file to be user rw only.This is a best effort attempt as Windows does NOT play nicely with file perms. - Parameters:
- an- existing File
 
- 
fileCreateCallsFile.createNewFile()on the specifiedtarget- Parameters:
- target- The target to create if it doesn't exist
- Returns:
- trueif call succeeded.
- Throws:
- IOException
 
 
-