Generates a deterministic temporary file name for the a path and a file id and a nonce.

@param nonce a nonce token
@param path a file path
@return a deterministic temporary file name
168316
public static String temporaryFileName(long nonce, String path) {
    return path + String.format(TEMPORARY_SUFFIX_FORMAT, nonce);
  }
205341
@NullSafe
  public static File assertExists(File path) throws FileNotFoundException {
    if (isExisting(path)) {
      return path;
    }

    throw new FileNotFoundException(String.format("[%1$s] was not found", path));
  }
525605
public static Stream<byte[]> binaryStream(final String path, @javax.annotation.Nonnull final String name, final int skip, final int recordSize) throws IOException {
    @javax.annotation.Nonnull final File file = new File(path, name);
    final byte[] fileData = IOUtils.toByteArray(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(file)))));
    @javax.annotation.Nonnull final DataInputStream in = new DataInputStream(new ByteArrayInputStream(fileData));
    in.skip(skip);
    return com.simiacryptus.util.Util.toIterator(new BinaryChunkIterator(in, recordSize));
  }
852170
protected String findClasspathFile(final String path) throws IOException {
        if (path == null){
            return null;
        }
        final File file = new File(path);
        if (file.exists()){
            return file.getAbsolutePath();
        }
        return createTmpFile(path).getAbsolutePath();
    }
106757
private function generateFilename($path, $extension)
    {
        $file = '';

        while (!$file || is_file($path.$file)) {
            $file = uniqid().'.'.$extension;
        }

        return $file;
    }
373171
public static String encodePath(String path) {
        URI tmp;

        try {
            tmp = new URI("foo", "host", "/" + path, null);
        } catch (URISyntaxException e) {
            throw new IllegalStateException(e);
        }
        return tmp.getRawPath().substring(1);
    }
602236
public static String cleanPath(String path) throws InvalidPathException {
    validatePath(path);
    return FilenameUtils.separatorsToUnix(FilenameUtils.normalizeNoEndSeparator(path));
  }
45070
public void setPath(String path) {
        this.path = path;
        if (null != path) {
            int i = path.lastIndexOf('.');
            if (i == path.length() - 4) {
                i = path.lastIndexOf('/');
                String p = path.substring(0, i);
                String f = path.substring(i + 1);
                recorder.setPath(p);
                recorder.setName(f);
            } else {
                recorder.setPath(path);
                //recorder.setName(VoiceRecorder.generateName());
            }
        }
    }
147841
public static String nameOnly(String path)
   {
      int index = path.lastIndexOf('/');
      String name = index == -1 ? path : path.substring(index + 1);
      if (name.endsWith("]"))
      {
         index = name.lastIndexOf('[');
         return index == -1 ? name : name.substring(0, index);
      }
      return name;
   }
1075410
protected static String addFileNameToTargetPath(String sourcePath, String targetPath) {
        if (targetPath.endsWith("/")) {
            String filename = Paths.get(sourcePath).getFileName().toString();
            return targetPath + filename;
        }
        return targetPath;
    }
237572
public static String dirname(String path)
    {
        int index = path.lastIndexOf('/');
        if (index == -1) return path;
        return path.substring(0, index + 1);
    }
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;
	}
269457
public static CheckpointStorageLocationReference encodePathAsReference(Path path) {
		byte[] refBytes = path.toString().getBytes(StandardCharsets.UTF_8);
		byte[] bytes = new byte[REFERENCE_MAGIC_NUMBER.length + refBytes.length];

		System.arraycopy(REFERENCE_MAGIC_NUMBER, 0, bytes, 0, REFERENCE_MAGIC_NUMBER.length);
		System.arraycopy(refBytes, 0, bytes, REFERENCE_MAGIC_NUMBER.length, refBytes.length);

		return new CheckpointStorageLocationReference(bytes);
	}
1064868
@Nonnull
  public File createDestinationFileForPath(@Nonnull final String path) {
    assertNotNull("Path is null", path);

    if (path.isEmpty()) {
      throw makeException("File name is empty", null);
    }

    return new File(this.getTarget(), path);
  }
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();
			}
	}
139250
public static String getName(String path, boolean ignoreTrailingSlash)
   {
      if (ignoreTrailingSlash && path.endsWith("/") && path.length() > 1)
      {
         path = path.substring(0, path.length() - 1);
      }
      return getName(path);
   }
1331096
@Nullable
  public static String getFilename(@Nullable final String path) {
    if (path == null) {
      return null;
    }

    final int separatorIndex = path.lastIndexOf(StringUtils.FOLDER_SEPARATOR);
    return separatorIndex != -1 ? path.substring(separatorIndex + 1) : path;
  }