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.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getSuffix

      public static java.lang.String getSuffix​(java.lang.String filename) throws java.lang.IllegalArgumentException
      Return 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 parameter filename is assumed to be a base file name, not a full path. Thus, the method will throw an IllegalArgumentException if filename 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 - if filename contains any slashes.