Create a new file.
Rotates off the current Writer and creates a new in its place
to take subsequent writes.  Usually called from {@link #checkSize()}.
@return Name of file created.
@throws IOException
194091
protected String createFile() throws IOException {
        generateNewBasename();
        String name = currentBasename + '.' + this.extension  +
            ((settings.getCompress())? DOT_COMPRESSED_FILE_EXTENSION: "") +
            OCCUPIED_SUFFIX;
        File dir = getNextDirectory(settings.calcOutputDirs());
        return createFile(new File(dir, name));
    }
1371963
public static File createFile(String filename) throws IOException {
		File file = new File(filename);
		if (!file.exists()) {
			if(file.getParent() != null) {
				File path = new File(file.getParent());
				path.mkdirs();
			}
			file.createNewFile();
		}
		return file;
	}
108744
@Override
  public void create()
    throws IOException
  {
    Files.createDirectories(_path.getParent());

    if (Files.exists(_path)) {
      throw new IOException(L.l("CREATE for path '{0}' failed, because the file already exists.  CREATE can not override an existing table.",
                                _path));
    }
    
    init();
    /*
    _channel = _path.openFileChannel(StandardOpenOption.CREATE, 
                                     StandardOpenOption.WRITE,
                                     StandardOpenOption.READ);
    
    setFileSize(_path.length());
    
    initImpl();
    */
  }
1145642
public IndexOutput createOutput(String name) throws IOException {
    Path file = new Path(directory, name);
    if (fs.exists(file) && !fs.delete(file)) {
      // delete the existing one if applicable
      throw new IOException("Cannot overwrite index file " + file);
    }

    return new FileSystemIndexOutput(file, ioFileBufferSize);
  }
1288777
public boolean createFile() {
        try {
            try (FileWriter newDic = new FileWriter(path + "/" + name + "." + FILE_EXTENSION); BufferedWriter bufWriter = new BufferedWriter(newDic)) {
                bufWriter.write(HEAD);
                if (sentences.size() > 0) {
                    bufWriter.write("public <sentence> = (" + sentences.get(0));

                    for (int i = 1; i < sentences.size(); i++) {
                        bufWriter.write(" | " + sentences.get(i));
                    }
                    bufWriter.write(" );\n");
                }
                bufWriter.flush();
            }
            return true;
        } catch (IOException ex) {
            Logger.getLogger(GrammarFacilitator.class.getName()).log(Level.SEVERE, null, ex);
        }
        return false;
    }
828644
public WritableByteChannel create(URI path) throws IOException {
    logger.atFine().log("create(%s)", path);
    return create(path, CreateFileOptions.DEFAULT);
  }
1256138
public static BufferedWriter createWriter(File file) throws IOException {
        OutputStream os = new FileOutputStream(file);
        if (file.getName().toLowerCase().endsWith(".gz"))
            os = new GZIPOutputStream(os);
        return new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8));
    }
736752
public static boolean createNewFile(File file) throws IOException {
        createFolder(file.getParent());
        return (!file.exists() || file.delete()) && file.createNewFile();
    }
710088
public boolean open() throws IOException {
    if (!osFile.exists())
      throw new FileNotFoundException("File: " + osFile.getAbsolutePath());

    openChannel((int) osFile.length());

    OLogManager.instance().debug(this, "Checking file integrity of " + osFile.getName() + "...");

    init();

    final int fileSize = getFileSize();
    final int filledUpTo = getFilledUpTo();

    if (filledUpTo > 0 && filledUpTo > fileSize) {
      OLogManager
          .instance()
          .warn(
              this,
              "invalid filledUp value (%d) for file %s. Resetting the file size %d to the os file size: %d. Probably the file was not closed correctly last time",
              filledUpTo, getOsFile().getAbsolutePath(), fileSize, fileSize);
      setSize(fileSize);
    }

    if (filledUpTo > fileSize || filledUpTo < 0)
      OLogManager.instance().error(this, "Invalid filledUp size (=" + filledUpTo + "). The file could be corrupted", null,
          OStorageException.class);

    if (failCheck) {
      boolean softlyClosed = isSoftlyClosed();

      if (softlyClosed)
        setSoftlyClosed(false);

      return softlyClosed;
    }
    return true;
  }
1056470
WritableByteChannel createInternal(URI path, CreateFileOptions options)
      throws IOException {

    // Validate the given path. false == do not allow empty object name.
    StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, false);
    if (options.getExistingGenerationId() != StorageResourceId.UNKNOWN_GENERATION_ID) {
      resourceId = new StorageResourceId(
          resourceId.getBucketName(),
          resourceId.getObjectName(),
          options.getExistingGenerationId());
    }
    WritableByteChannel channel = gcs.create(resourceId, objectOptionsFromFileOptions(options));
    tryUpdateTimestampsForParentDirectories(ImmutableList.of(path), ImmutableList.<URI>of());
    return channel;
  }
1198799
public static RefCountedFile newFile(
			final File file,
			final OutputStream currentOut) throws IOException {
		return new RefCountedFile(file, currentOut, 0L);
	}
1183180
public NamedOdsFileWriter createWriter(final File file) throws IOException {
        final NamedOdsDocument document = this.createNamedDocument();
        final NamedOdsFileWriter writer = OdsFileDirectWriter.builder(this.logger, document)
                .openResult(this.openFile(file)).build();
        document.addObserver(writer);
        document.prepareFlush();
        return writer;
    }
109276
@Override
  public void create() throws IOException {
    fc.truncate(0);
    fc.position(0);
    doubleBuf.getCurrentBuf().writeInt(FSConstants.LAYOUT_VERSION);
    setReadyToFlush();
    flush();
  }
319729
@Override
  public FSDataOutputStream create(Path f, FsPermission permission,
    boolean overwrite,
    int bufferSize, short replication, long blockSize,
    Progressable progress) throws IOException {

    FSDataOutputStream fd = new FSDataOutputStream(
                                new CacheOutputStream(conf, this, f,
                                    permission, overwrite, bufferSize,
                                    replication, blockSize, progress));

    return fd;
  }
841721
public File rename(File f) {
    if (createNewFile(f)) {
      return f;
    }
    String name = f.getName();
    String body = null;
    String ext = null;

    int dot = name.lastIndexOf(".");
    if (dot != -1) {
      body = name.substring(0, dot);
      ext = name.substring(dot);  // includes "."
    }
    else {
      body = name;
      ext = "";
    }

    // Increase the count until an empty spot is found.
    // Max out at 9999 to avoid an infinite loop caused by a persistent
    // IOException, like when the destination dir becomes non-writable.
    // We don't pass the exception up because our job is just to rename,
    // and the caller will hit any IOException in normal processing.
    int count = 0;
    while (!createNewFile(f) && count < 9999) {
      count++;
      String newName = body + count + ext;
      f = new File(f.getParent(), newName);
    }

    return f;
  }
1073093
public AsyncWork<File, IOException> createFileAsync(String prefix, String suffix) {
		return new Task.OnFile<File, IOException>(tempDir, "Create temporary file", Task.PRIORITY_NORMAL) {
			@Override
			public File run() throws IOException {
				return createFileSync(prefix, suffix);
			}
		}.start().getOutput();
	}
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;
    }