Java Path Exist nio makeTempFilePath(boolean exists)

Here you can find the source of makeTempFilePath(boolean exists)

Description

make Temp File Path

License

Open Source License

Declaration

public static Path makeTempFilePath(boolean exists) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
    public static Path makeTempFilePath(boolean exists) throws IOException {
        Path result;/*ww w.  j ava2  s  .c om*/
        if (System.getenv().containsKey("TEST_TMPDIR")) {
            result = Files.createTempFile(Paths.get(System.getenv("TEST_TMPDIR")), "", "json");
        } else {
            result = Files.createTempFile("", "json");
        }
        if (!exists) {
            Files.delete(result);
        }
        return result;
    }
}

Related

  1. fileExists(Path path)
  2. getNonExisting(Path path)
  3. isExists(final Path path)
  4. isFileExists(Path file)
  5. lenientExists(Path file)