/** * Sets output file to mode 600 */ public SecureFileOutputStream(File file) throws FileNotFoundException { super(file); setPerms(file); }
/** * Sets output file to mode 600 only if append = false * (otherwise it is presumed to be 600 already) */ public SecureFileOutputStream(File file, boolean append) throws FileNotFoundException { super(file, append); //if (!append) setPerms(file); }
/** * Sets output file to mode 600 whether append = true or false */ public SecureFileOutputStream(String file, boolean append) throws FileNotFoundException { super(file, append); //if (!append) setPerms(new File(file)); }
/** * Sets file to mode 600 when the file is created */ public static File createTempFile(String prefix, String suffix) throws IOException { File rv = File.createTempFile(prefix, suffix); // same thing as below but static SecureFileOutputStream.setPerms(rv); return rv; }
/** * Sets file to mode 600 when the file is created */ public static File createTempFile(String prefix, String suffix, File directory) throws IOException { File rv = File.createTempFile(prefix, suffix, directory); // same thing as below but static SecureFileOutputStream.setPerms(rv); return rv; }
/** * Sets output file to mode 600 */ public SecureFileOutputStream(String file) throws FileNotFoundException { super(file); setPerms(new File(file)); }
SecureFileOutputStream.setPerms(ks); info("Created self-signed certificate for " + cname + " in keystore: " + ks.getAbsolutePath()); } else {
/** * Add a torrent from a file not in the torrent directory. Copy the file to filename. * Holds the snarks lock to prevent interference from the DirMonitor. * Caller must verify this torrent is not already added. * This may take a LONG time to create or check the storage. * * @param fromfile where the file is now, presumably in a temp directory somewhere * @param filename the absolute path to save the metainfo to, generally ending in ".torrent", which is also the name of the torrent * Must be a filesystem-safe name. * @param dataDir must exist, or null to default to snark data directory * @throws RuntimeException via Snark.fatal() * @since 0.8.4 */ public void copyAndAddTorrent(File fromfile, String filename, File dataDir) throws IOException { // prevent interference by DirMonitor synchronized (_snarks) { boolean success = FileUtil.copy(fromfile.getAbsolutePath(), filename, false); if (!success) { addMessage(_t("Failed to copy torrent file to {0}", filename)); _log.error("Failed to write torrent file to " + filename); return; } if (!areFilesPublic()) SecureFileOutputStream.setPerms(new File(filename)); // hold the lock for a long time addTorrent(filename, null, false, dataDir); } }
f = new File(_context.getBaseDir(), "wrapper.log"); if (f.exists()) SecureFileOutputStream.setPerms(f);
File backup = new File(backupDir, name); if (FileUtil.copy(keyFile, backup, false, true)) { SecureFileOutputStream.setPerms(backup); log("Private key backup saved to " + backup.getAbsolutePath());
SecureFileOutputStream.setPerms(f); bf = initNew(raf); } catch (IOException ioe) {
File backup = new File(backupDir, name); if (FileUtil.copy(altFile, backup, false, true)) { SecureFileOutputStream.setPerms(backup); log("Alternate private key backup saved to " + backup.getAbsolutePath());