Class Helper

java.lang.Object
org.sentrysoftware.maven.skin.Helper

public final class Helper extends Object
Utility class with various static helper functions.
  • Method Details

    • writeText

      public static void writeText(File file, String text, Charset charset) throws IOException
      Write a text file using System.lineSeparator()
      Parameters:
      file - The file instance to write to
      text - The text to write
      charset - The charset to use when writing text
      Throws:
      IOException - when anything goes wrong
    • getLastModifiedTime

      public static long getLastModifiedTime(Path path)
      Returns the time of last modification of specified Path in milliseconds since EPOCH.
      Parameters:
      path - Path to the file
      Returns:
      Milliseconds since EPOCH, or 0 (zero) if file does not exist
    • getLastModifiedTime

      public static long getLastModifiedTime(File file)
      Returns the time of last modification of specified File in milliseconds since EPOCH.
      Parameters:
      file - File instance
      Returns:
      Milliseconds since EPOCH, or 0 (zero) if file does not exist
    • getLastModifiedTime

      public static long getLastModifiedTime(String filePathString)
      Returns the time of last modification of specified file in milliseconds since EPOCH.
      Parameters:
      filePathString - Path to the file (as a String)
      Returns:
      Milliseconds since EPOCH, or 0 (zero) if file does not exist
    • readResourceAsString

      public static String readResourceAsString(String resourcePath) throws IOException
      Reads the content of a resource file and returns it as a String.
      Parameters:
      resourcePath - The path to the resource file
      Returns:
      The content of the resource file as a String
      Throws:
      IOException - If an I/O error occurs