Package edu.rit.io

Class Files

java.lang.Object
edu.rit.io.Files

public class Files extends Object
Class Files provides static methods for various file related operations.
Version:
26-Nov-2007
Author:
Alan Kaminsky
  • Method Details

    • fileForRank

      public static File fileForRank(File file, int rank)
      Append the given rank to the given file. The rank goes before the file extension if any. For example, Files.fileForRank(new File("image.pjg"),2) returns a File whose name is "image_2.pjg"; Files.fileForRank(new File("image"),2) returns a File whose name is "image_2".
      Parameters:
      file - File.
      rank - Rank.
      Returns:
      File with rank appended.
    • fileNameForRank

      public static String fileNameForRank(String filename, int rank)
      Append the given rank to the given file name. The rank goes before the file extension if any. For example, Files.fileNameForRank("image.pjg",2) returns "image_2.pjg"; Files.fileNameForRank("image",2) returns "image_2".
      Parameters:
      filename - File name.
      rank - Rank.
      Returns:
      File name with rank appended.
    • fileAppend

      public static File fileAppend(File file, String suffix)
      Append the given suffix to the given file. The suffix goes before the file extension if any. For example, Files.fileAppend(new File("image.pjg"),"_new") returns a File whose name is "image_new.pjg"; Files.fileAppend(new File("image"),"_new") returns a File whose name is "image_new".
      Parameters:
      file - File.
      suffix - Suffix.
      Returns:
      File with suffix appended.
    • fileNameAppend

      public static String fileNameAppend(String filename, String suffix)
      Append the given suffix to the given file name. The suffix goes before the file extension if any. For example, Files.fileNameAppend("image.pjg","_new") returns "image_new.pjg"; Files.fileNameAppend("image","_new") returns "image_new".
      Parameters:
      filename - File name.
      suffix - Suffix.
      Returns:
      File name with suffix appended.
    • filePrepend

      public static File filePrepend(File file, String prefix)
      Prepend the given prefix to the given file. The prefix goes after the directory if any. For example, Files.filePrepend(new File("/home/ark/image.pjg"),"new_") returns a File whose name is "/home/ark/new_image.pjg"; Files.filePrepend(new File("image.pjg"),"new_") returns a File whose name is "new_image.pjg". The system-dependent file name separator character is used to detect the end of the directory if any.
      Parameters:
      file - File.
      prefix - Prefix.
      Returns:
      File with prefix prepended.
    • fileNamePrepend

      public static String fileNamePrepend(String filename, String prefix)
      Prepend the given prefix to the given file name. The prefix goes after the directory if any. For example, Files.fileNamePrepend("/home/ark/image.pjg","new_") returns "/home/ark/new_image.pjg"; Files.fileNamePrepend("image.pjg","new_") returns "new_image.pjg". The system-dependent file name separator character is used to detect the end of the directory if any.
      Parameters:
      filename - File name.
      prefix - Prefix.
      Returns:
      File name with prefix prepended.