Creates the file including content. Override this method to implement a custom mechanism to create the temporary
file
@return
the file handle to the newly created file
@throws IOException
768083
protected File createTempFile() throws IOException {

        final File tempFile = newFile();
        if (forceContent && contentUrl == null) {
            throw new AssertionError("ContentUrl is not set");
        } else if (contentUrl == null) {
            createEmptyFile(tempFile);
        } else {
            try (InputStream inputStream = contentUrl.openStream()) {
                Files.copy(inputStream, tempFile.toPath());
            }
        }
        return tempFile;
    }
200513
protected void create(File file) throws IOException {
        if(!file.exists()) {
            File dir = file.getParentFile();
            if(dir.exists()) file.createNewFile();
            else if(dir.mkdirs()) file.createNewFile();
            else throw new IOException("Failed to create " + file.getAbsolutePath());
        }
        
        if(file.isDirectory()) {
            throw new IOException("Cannot open directory " + file.getAbsolutePath());
        }
    }
1268876
private void createDirAndFile(Path path) throws IOException {
			// create dir and file first if dir/file not exist
			File file = new File(path.toAbsolutePath().toString());
			File dir = file.getParentFile();
			if (dir != null && !dir.exists()) {
				dir.mkdirs();
			}
			if (!file.exists()) {
				file.createNewFile();
			}
	}
130301
public static Map<String, IDLProxyObject> create(File file) throws IOException {
        return create(file, false);
    }
828644
public WritableByteChannel create(URI path) throws IOException {
    logger.atFine().log("create(%s)", path);
    return create(path, CreateFileOptions.DEFAULT);
  }
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);
    }
398057
public File createArchive()
        throws MojoExecutionException
    {
        File jarFile = getJarFile( outputDirectory, finalName, getClassifier() );

        MavenArchiver archiver = new MavenArchiver();

        archiver.setArchiver( jarArchiver );

        archiver.setOutputFile( jarFile );

        archive.setForced( forceCreation );

        try
        {
            File contentDirectory = getClassesDirectory();
            if ( !contentDirectory.exists() )
            {
                getLog().warn( "JAR will be empty - no content was marked for inclusion!" );
            }
            else
            {
                archiver.getArchiver().addDirectory( contentDirectory, DEFAULT_INCLUDES, DEFAULT_EXCLUDES );
            }

            archiver.createArchive(mavenSession, project, archive);

            return jarFile;
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( "Error assembling JAR", e );
        }
    }
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();
  }
1159005
public static <T extends Serializable> File serializeToTempFile(T obj) throws IOException
        {
                File file = File.createTempFile(Serializer.class.getName().replace(".*\\.",""), null);
                file.deleteOnExit();
                serializeToFile(obj,file);
		return file;
        }
594020
private void createDataFile() throws IOException {
        // temporary data file for storage of stream data
        Path path = Paths.get(filePath + ".ser");
        if (Files.deleteIfExists(path)) {
            log.debug("Previous flv data file existed and was removed");
        }
        this.dataChannel = Files.newByteChannel(path, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE, StandardOpenOption.READ);
    }
778080
private String createTempFile(final boolean verbose) throws IOException {
        final File tempFile = File.createTempFile("tempMetadata", ".xml");

        if (!verbose) {
            tempFile.deleteOnExit();
        }

        return tempFile.getAbsolutePath();
    }
905860
private File createNewFile(String path) throws IOException {

		// In windows, pathnames with spaces are returned as %20
		if (path.contains("%20"))
			path = path.replaceAll("%20", " ");
		File newFile = new File(path);

		if (!newFile.exists() && !newFile.createNewFile()) {
			throw new BundlingProcessException("Unable to create a temporary file at " + path);
		}

		if (LOGGER.isDebugEnabled())
			LOGGER.debug("Created file: " + newFile.getCanonicalPath());
		return newFile;
	}
1227126
public static File createPictureFile(Context context) throws IOException {
        Locale locale = Locale.getDefault();
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", locale).format(new Date());
        String fileName = "JPEG_" + timeStamp + "_";
        // Store in normal camera directory
        File storageDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
        return File.createTempFile(fileName, ".jpg", storageDir);
    }
934425
public static File saveToTempFolder(Part part) throws IOException {
    String filename = getOriginalFileName(part);
    if (filename == null) {
      return null;
    }

    File file = new File(FileUtils.getTempDirectory(), filename);
    FileCopyUtils.copy(part.getInputStream(), new FileOutputStream(file));

    return file;
  }
742004
public static File copyToTempFile(InputStream serialization)
            throws IOException, FileNotFoundException {
        File tempFile = createTempFile();
        StreamUtility.pipeStream(serialization,
                                 new FileOutputStream(tempFile),
                                 4096);
        return tempFile;
    }
544471
public static RandomAccessFile createTemporaryFile
        (String prefix, String suffix) throws IOException {

        return createTemporaryFile(prefix, suffix, null);
    }