net.i2p.util

## Class SecureFile

- java.lang.Object
- - java.io.File
  - - net.i2p.util.SecureDirectory
    - - net.i2p.util.SecureFile

- All Implemented Interfaces:
    Serializable, Comparable<File>

      public class SecureFile
      extends SecureDirectory

  Same as SecureDirectory but sets the file mode after createNewFile() and createTempFile() also. So just use this instead. Probably should have just made this class in the beginning and not had two.
  Since:
    0.8.2
  Author:
    zzz
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class net.i2p.util.SecureDirectory

      `isNotWindows`

    - ### Fields inherited from class java.io.File

      `pathSeparator, pathSeparatorChar, separator, separatorChar`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SecureFile(File parent, String child)`
    `SecureFile(String pathname)`
    `SecureFile(String parent, String child)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `createNewFile()` Sets file to mode 600 if the file is created
    `static File` | `createTempFile(String prefix, String suffix)` Sets file to mode 600 when the file is created
    `static File` | `createTempFile(String prefix, String suffix, File directory)` Sets file to mode 600 when the file is created
    `protected void` | `setPerms()` Tries to set the permissions to 600, ignores errors

    - ### Methods inherited from class net.i2p.util.SecureDirectory

      `mkdir, mkdirs`

    - ### Methods inherited from class java.io.File

      `canExecute, canRead, canWrite, compareTo, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SecureFile

          public SecureFile(String pathname)

    - #### SecureFile

          public SecureFile(String parent,
                    String child)

    - #### SecureFile

          public SecureFile(File parent,
                    String child)

  - ### Method Detail

    - #### createNewFile

          public boolean createNewFile()
                                throws IOException

      Sets file to mode 600 if the file is created
      Overrides:
        `createNewFile` in class `File`
      Throws:
        `IOException`

    - #### createTempFile

          public static File createTempFile(String prefix,
                            String suffix)
                                     throws IOException

      Sets file to mode 600 when the file is created
      Throws:
        `IOException`

    - #### createTempFile

          public static File createTempFile(String prefix,
                            String suffix,
                            File directory)
                                     throws IOException

      Sets file to mode 600 when the file is created
      Throws:
        `IOException`

    - #### setPerms

          protected void setPerms()

      Tries to set the permissions to 600, ignores errors
      Overrides:
        `setPerms` in class `SecureDirectory`