Create a <code>File</code> object with the name of this Journal file.
Check to be sure that no such file already exists.
333495
private File createFilename(String filenamePrefix, File journalDirectory)
            throws JournalException {
        String filename =
                JournalHelper.createTimestampedFilename(filenamePrefix,
                                                        new Date());
        File theFile = new File(journalDirectory, filename);

        if (theFile.exists()) {
            throw new JournalException("File '" + theFile.getPath()
                    + "' already exists.");
        }

        return theFile;
    }
841082
public static File newFile(String fileName) {
		File file = new File(fileName);
		if(file.exists())
			file.delete();
		return file;
	}
227860
public static File writeObjectToFile(Object o, String filename)
  throws IOException {
    return writeObjectToFile(o, new File(filename));
  }
319484
private void createBackupFile() {
        if (createBackupFile) {
            if (backupFileExtension.trim().length() == 0) {
                throw new FailureException("Could not create backup file, extension name was empty");
            }
            fileUtil.backupFile();
            log.info(String.format("Saved backup of %s to %s%s", pomFile.getAbsolutePath(),
                    pomFile.getAbsolutePath(), backupFileExtension));
        }
    }
800601
public File getFile(String name) {
		if (name == null) {
			throw new NullPointerException("name must not be null");
		}

		Future<Path> future = cacheCopyTasks.get(name);
		if (future == null) {
			throw new IllegalArgumentException("File with name '" + name + "' is not available." +
					" Did you forget to register the file?");
		}

		try {
			final Path path = future.get();
			URI tmp = path.makeQualified(path.getFileSystem()).toUri();
			return new File(tmp);
		}
		catch (ExecutionException e) {
			throw new RuntimeException("An error occurred while copying the file.", e.getCause());
		}
		catch (Exception e) {
			throw new RuntimeException("Error while getting the file registered under '" + name +
					"' from the distributed cache", e);
		}
	}
859900
public File saveAs(File destFile, boolean overwrite) throws IOException {
        if (destFile == null) {
            throw new IllegalArgumentException("destFile can not be null");
        }

        try {
            destFile = determineDestinationFile(destFile, overwrite);

            final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
            int len;
            try (InputStream input = getInputStream(); OutputStream output = new FileOutputStream(destFile)) {
                while ((len = input.read(buffer)) != -1) {
                    output.write(buffer, 0, len);
                }
            }
        } catch (Exception e) {
            throw new IOException("Could not save as file " + destFile, e);
        }

        setSavedFile(destFile);
        return destFile;
    }
1153239
def _create_file(path=''):
        '''  '''
        from os.path import isfile
        if not isfile(path): # only do the following if the file doesn't exist yet
            from os import chmod
            from stat import S_IRUSR, S_IWUSR

            open(path, "a").close()  # create the file
            attempt(lambda: chmod(path, (S_IRUSR | S_IWUSR)))
278201
private static File createTempFile() throws IOException
  {
    File file = File.createTempFile(TMP_FILE_PREFIX, TMP_FILE_EXTENSION);
    file.deleteOnExit();
    return file;
  }
572672
@VisibleForTesting
  static File createSnapshotFile(File directory, String serverName, long index) {
    return new File(directory, createSnapshotFileName(serverName, index));
  }
1067828
def _create_file(self, filename):
        """"""
        file_descriptor = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_EXCL)
        return os.fdopen(file_descriptor, 'w')
185266
public Writer getFileObjectWriter(String path, String filename) throws IOException {
		File dir = new File(path);
		if (!dir.exists()) {
			dir.mkdirs();
		}
		return new FileWriter(new File(dir, filename));
	}
1196258
static void createFileFromResource(String resource, Resource file, String password) throws IOException {
	SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), "write file:" + file);
	file.delete();

	InputStream is = InfoImpl.class.getResourceAsStream(resource);
	if (is == null) throw new IOException("file [" + resource + "] does not exist.");
	file.createNewFile();
	IOUtil.copy(is, file, true);
    }
1134951
public WritableByteChannel create(URI path, CreateFileOptions options) throws IOException {
    logger.atFine().log("create(%s)", path);
    Preconditions.checkNotNull(path, "path could not be null");
    if (FileInfo.isDirectoryPath(path)) {
      throw new IOException(
          String.format("Cannot create a file whose name looks like a directory. Got '%s'", path));
    }

    // Check if a directory of that name exists.
    if (options.checkNoDirectoryConflict()) {
      URI dirPath = FileInfo.convertToDirectoryPath(pathCodec, path);
      if (exists(dirPath)) {
        throw new FileAlreadyExistsException("A directory with that name exists: " + path);
      }
    }

    // Ensure that parent directories exist.
    if (options.ensureParentDirectoriesExist()) {
      URI parentPath = getParentPath(path);
      if (parentPath != null) {
        mkdirs(parentPath);
      }
    }

    return createInternal(path, options);
  }
776892
protected String createFile(String dir, String fileName, byte[] content) {
        String baseName = FilenameUtils.getBaseName(fileName);
        String ext = FilenameUtils.getExtension(fileName);
        String downloadedFile = FileUtil.saveToFile(dir + baseName, ext, content);
        return linkToFile(downloadedFile);
    }
49850
static File createSnapshotFile(String name, File directory, long index, long timestamp) {
    return new File(directory, String.format("%s-%d-%s.snapshot", Assert.notNull(name, "name"), index, TIMESTAMP_FORMAT.format(new Date(timestamp))));
  }
1002533
@Override
    public void openFile(String repositoryHash,
                         String filename,
                         Date currentDate) throws JournalException {
        try {
            super.testStateChange(State.FILE_OPEN);

            writer = new RmiTransportWriter(receiver, repositoryHash, filename);
            xmlWriter =
                    new IndentingXMLEventWriter(XMLOutputFactory
                            .newInstance()
                            .createXMLEventWriter(new BufferedWriter(writer,
                                                                     bufferSize)));

            parent.writeDocumentHeader(xmlWriter, repositoryHash, currentDate);

            super.setState(State.FILE_OPEN);
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        } catch (FactoryConfigurationError e) {
            throw new JournalException(e);
        }
    }
26595
public static File newFile(String path, String content) throws FileAlreadyExistsException {
        File file = new File(path);
        boolean created;
        try {
            created = file.createNewFile();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        if (!created) {
            throw new FileAlreadyExistsException("Failed to create'" + path + "'. May be file already exists!");
        }
        try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
            writer.write(content);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return file;
    }