Package edu.gvsu.kurmasz.warszawa.io
Class FileHelper
java.lang.Object
edu.gvsu.kurmasz.warszawa.io.FileHelper
public class FileHelper
extends java.lang.Object
- Author:
- Zachary Kurmas
-
Constructor Summary
Constructors Constructor Description FileHelper()
-
Method Summary
Modifier and Type Method Description static java.lang.String
getSuffix(java.lang.String filename)
Return the filename suffix.
-
Constructor Details
-
FileHelper
public FileHelper()
-
-
Method Details
-
getSuffix
public static java.lang.String getSuffix(java.lang.String filename) throws java.lang.IllegalArgumentExceptionReturn the filename suffix. The suffix is defined to be the part of the file name after the final period. The leading dots do not count. Thus, ".bashrc" has no suffix. (It does not have a suffix of "bashrc".) Similarly, the files ".." and "..data" also have no suffix. The parameterfilename
is assumed to be a base file name, not a full path. Thus, the method will throw anIllegalArgumentException
iffilename
contains any directory separator characters (i.e., "/" on Unix and "\\" on Windows). (In the future I may modify this method to handle full path names, I just have not yet had the need to do it. If you want this feature, just ask.)- Parameters:
filename
- the files base name (i.e., directory separators are not currently allowed.)- Returns:
- the filename's suffix (the part after the final period.
- Throws:
java.lang.IllegalArgumentException
- iffilename
contains any slashes.
-