|
g-Eclipse Release 1.0.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.File
eu.geclipse.core.util.SecureFile
public class SecureFile
This class is an extension of java.io.File providing creation of files and folders with secure permissions, if supported by the underlying OS! Sadly there is no way to manage file/folder permissions in Java <= 5 or in Eclipse itself. This class should go away with the use of Java 6...
File,
Serialized Form| Field Summary |
|---|
| Fields inherited from class java.io.File |
|---|
pathSeparator, pathSeparatorChar, separator, separatorChar |
| Constructor Summary | |
|---|---|
SecureFile(java.io.File parent,
java.lang.String child)
Creates a new SecureFile instance from a parent abstract
pathname and a child pathname string. |
|
SecureFile(java.lang.String pathname)
Creates a new SecureFile instance by converting the
given pathname string into an abstract pathname. |
|
SecureFile(java.lang.String parent,
java.lang.String child)
Creates a new SecureFile instance from a parent
pathname string and a child pathname string. |
|
SecureFile(java.net.URI uri)
Creates a new SecureFile instance by converting the
given URI into an abstract pathname. |
|
| Method Summary | |
|---|---|
boolean |
createNewFile()
Atomically creates a new, empty, protected file named by this abstract pathname if and only if a file with this name does not yet exist. |
static SecureFile |
createTempFile(java.lang.String prefix,
java.lang.String suffix)
Creates a protected empty file in the default temporary-file directory, using the given prefix and suffix to generate its name. |
static SecureFile |
createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File directory)
Creates a protected empty file in the specified directory, using the given prefix and suffix to generate its name. |
boolean |
isSecure()
Tests whether the file named by this abstract pathname has secure permissions. |
boolean |
mkdir()
Creates the secure directory named by this abstract pathname. |
boolean |
mkdirs()
Creates the secure directory named by this abstract pathname, including any necessary but nonexistent parent directories. |
boolean |
renameTo(java.io.File dest)
Renames the file denoted by this abstract pathname. |
boolean |
setSecure()
Set secure permissions on the existing file named by this abstract pathname. |
| Methods inherited from class java.io.File |
|---|
canRead, canWrite, compareTo, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, setLastModified, setReadOnly, toString, toURI, toURL |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SecureFile(java.lang.String pathname)
SecureFile instance by converting the
given pathname string into an abstract pathname. Never forget to
actually _create_ the file with one of the create*File() methods,
or call setSecure() if the file already exists, before writing
data inside with a FileOutputStream!
pathname - A pathname stringFile.File(String)
public SecureFile(java.lang.String parent,
java.lang.String child)
SecureFile instance from a parent
pathname string and a child pathname string. Never forget to
actually _create_ the file with one of the create*File() methods,
or call setSecure() if the file already exists, before writing
data inside with a FileOutputStream!
parent - The parent abstract pathnamechild - The child pathname stringFile.File(String, String)
public SecureFile(java.io.File parent,
java.lang.String child)
SecureFile instance from a parent abstract
pathname and a child pathname string. Never forget to
actually _create_ the file with one of the create*File() methods,
or call setSecure() if the file already exists, before writing
data inside with a FileOutputStream!
parent - The parent abstract pathnamechild - The child pathname stringFile.File(File, String)public SecureFile(java.net.URI uri)
SecureFile instance by converting the
given URI into an abstract pathname. Never forget to
actually _create_ the file with one of the create*File() methods,
or call setSecure() if the file already exists, before writing
data inside with a FileOutputStream!
uri - A URIFile.File(URI)| Method Detail |
|---|
public boolean setSecure()
throws java.io.IOException
true if the named file could be set to secure
permissions; false if the file didn't exist
java.io.IOException - if setting the permissions failedpublic boolean isSecure()
true if the named file exists and has secure
permissions; false otherwise
public boolean createNewFile()
throws java.io.IOException
createNewFile in class java.io.Filetrue if the named file does not exist and was
successfully created with secure permissions; false
if the named file already exists
java.io.IOException - if setting the permissions failed
public static SecureFile createTempFile(java.lang.String prefix,
java.lang.String suffix)
throws java.io.IOException
createTempFile(prefix, suffix, null).
java.io.IOExceptionFile.createTempFile(String, String)
public static SecureFile createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File directory)
throws java.io.IOException
java.io.IOExceptionFile.createTempFile(String, String, File)public boolean renameTo(java.io.File dest)
renameTo in class java.io.Filetrue if and only if the renaming succeeded;
false otherwiseFile.renameTo(File)public boolean mkdir()
mkdir in class java.io.Filetrue if and only if the directory was
created with secure permissions; false otherwiseFile.mkdir()public boolean mkdirs()
mkdirs in class java.io.Filetrue if and only if the directory was created
with secure permissions, along with all necessary parent
directories; false otherwiseFile.mkdirs()
|
g-Eclipse Release 1.0.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||