|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.wsspi.kernel.service.utils.FileUtils
public class FileUtils
A set of utilities for working with Files
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static boolean |
ensureDirExists(java.io.File dir)
Calls File.mkdirs() and File.exists() on the specified target |
static boolean |
fileCanRead(java.io.File target)
Execute the File.canRead() from within a PrivilegedAction . |
static boolean |
fileCanWrite(java.io.File target)
Execute the File.canWrite() from within a PrivilegedAction . |
static boolean |
fileDelete(java.io.File file)
Delete file |
static boolean |
fileExists(java.io.File target)
Execute the File.exists() from within a PrivilegedAction . |
static boolean |
fileIsDirectory(java.io.File target)
Execute the File.isDirectory() from within a PrivilegedAction . |
static boolean |
fileIsFile(java.io.File target)
Execute the File.isFile() from within a PrivilegedAction . |
static long |
fileLastModified(java.io.File target)
Execute the File.lastModified() from within a PrivilegedAction . |
static long |
fileLength(java.io.File target)
Execute the File.length() from within a PrivilegedAction . |
static boolean |
fileMkDirs(java.io.File target)
Calls File.mkdirs() on the specified target from
within a PrivilegedAction . |
static java.io.InputStream |
getInputStream(java.io.File target)
Create a new InputStream for the file within a PrivilegedAction . |
static java.lang.String[] |
list(java.io.File target)
Execute the File.list() from within a PrivilegedAction . |
static java.io.File[] |
listFiles(java.io.File target)
Execute the File.listFiles() from within a PrivilegedAction . |
static boolean |
setUserReadWriteOnly(java.io.File file)
Set the file permissions of the file to be user rw only. |
static boolean |
tryToClose(java.io.Closeable closeable)
Close the closeable object |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static boolean fileIsFile(java.io.File target)
File.isFile()
from within a PrivilegedAction
.
f
-
public static boolean fileIsDirectory(java.io.File target)
File.isDirectory()
from within a PrivilegedAction
.
f
-
public static boolean fileExists(java.io.File target)
File.exists()
from within a PrivilegedAction
.
target
-
public static long fileLength(java.io.File target)
File.length()
from within a PrivilegedAction
.
target
-
public static java.io.File[] listFiles(java.io.File target)
File.listFiles()
from within a PrivilegedAction
.
f
-
public static java.lang.String[] list(java.io.File target)
File.list()
from within a PrivilegedAction
.
f
-
public static java.io.InputStream getInputStream(java.io.File target) throws java.io.FileNotFoundException
InputStream
for the file within a PrivilegedAction
.
java.io.FileNotFoundException
public static long fileLastModified(java.io.File target)
File.lastModified()
from within a PrivilegedAction
.
target
- The file to get the last modified for
public static boolean fileCanRead(java.io.File target)
File.canRead()
from within a PrivilegedAction
.
target
- The file to test if it can be read
true
if the file can be readpublic static boolean fileCanWrite(java.io.File target)
File.canWrite()
from within a PrivilegedAction
.
target
- The file to test if it can be written
true
if the file can be writtenpublic static boolean fileMkDirs(java.io.File target)
File.mkdirs()
on the specified target
from
within a PrivilegedAction
.
target
- The tarket to make a directory for
true
if this succeeded.public static boolean fileDelete(java.io.File file)
true
if file was deletedpublic static boolean ensureDirExists(java.io.File dir)
File.mkdirs()
and File.exists()
on the specified target
target
- The target to check for existence or to create if it doesn't exist
true
if either call succeeded.public static boolean tryToClose(java.io.Closeable closeable)
closeable
- public static boolean setUserReadWriteOnly(java.io.File file)
This is a best effort attempt as Windows does NOT play nicely with file perms.
an
- existing File
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |