edu.rit.io
Class Files
- java.lang.Object
-
- edu.rit.io.Files
-
public class Files extends java.lang.ObjectClass Files provides static methods for various file related operations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.io.FilefileAppend(java.io.File file, java.lang.String suffix)Append the given suffix to the given file.static java.io.FilefileForRank(java.io.File file, int rank)Append the given rank to the given file.static java.lang.StringfileNameAppend(java.lang.String filename, java.lang.String suffix)Append the given suffix to the given file name.static java.lang.StringfileNameForRank(java.lang.String filename, int rank)Append the given rank to the given file name.static java.lang.StringfileNamePrepend(java.lang.String filename, java.lang.String prefix)Prepend the given prefix to the given file name.static java.io.FilefilePrepend(java.io.File file, java.lang.String prefix)Prepend the given prefix to the given file.
-
-
-
Method Detail
-
fileForRank
public static java.io.File fileForRank(java.io.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 java.lang.String fileNameForRank(java.lang.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 java.io.File fileAppend(java.io.File file, java.lang.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 java.lang.String fileNameAppend(java.lang.String filename, java.lang.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 java.io.File filePrepend(java.io.File file, java.lang.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 java.lang.String fileNamePrepend(java.lang.String filename, java.lang.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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG