Package net.i2p.util
Class SecureFileOutputStream
java.lang.Object
java.io.OutputStream
java.io.FileOutputStream
net.i2p.util.SecureFileOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class SecureFileOutputStream extends FileOutputStream
Same as FileOutputStream but sets the file mode so it can only
be read and written by the owner only (i.e. 600 on linux)
- Since:
- 0.8.1
- Author:
- zzz
-
Constructor Summary
Constructors Constructor Description SecureFileOutputStream(File file)
Sets output file to mode 600SecureFileOutputStream(File file, boolean append)
Sets output file to mode 600 only if append = false (otherwise it is presumed to be 600 already)SecureFileOutputStream(String file)
Sets output file to mode 600SecureFileOutputStream(String file, boolean append)
Sets output file to mode 600 whether append = true or false -
Method Summary
Modifier and Type Method Description (package private) static boolean
canSetPerms()
static void
setPerms(File f)
Tries to set the permissions to 600, ignores errors
-
Constructor Details
-
SecureFileOutputStream
Sets output file to mode 600- Throws:
FileNotFoundException
-
SecureFileOutputStream
Sets output file to mode 600 whether append = true or false- Throws:
FileNotFoundException
-
SecureFileOutputStream
Sets output file to mode 600- Throws:
FileNotFoundException
-
SecureFileOutputStream
Sets output file to mode 600 only if append = false (otherwise it is presumed to be 600 already)- Throws:
FileNotFoundException
-
-
Method Details
-
canSetPerms
static boolean canSetPerms()- Since:
- 0.8.2
-
setPerms
Tries to set the permissions to 600, ignores errors
-