Class ClasUtilsFile

java.lang.Object
org.jlab.utils.system.ClasUtilsFile

public class ClasUtilsFile extends Object
Author:
gavalian
  • Constructor Details

    • ClasUtilsFile

      public ClasUtilsFile()
  • Method Details

    • getName

      public static String getName()
    • printLog

      public static void printLog(String log)
      prints a log message with the module name included.
      Parameters:
      log -
    • getResourceDir

      public static String getResourceDir(String env, String rpath)
      returns package resource directory with given enviromental variable and relative path.
      Parameters:
      env -
      rpath -
      Returns:
    • getFileList

      public static List<String> getFileList(String directory)
      returns list of files in the directory. absolute path is given. This function will not exclude ".*" and "*~" files.
      Parameters:
      directory -
      Returns:
    • getFileList

      public static List<String> getFileList(String env, String rpath)
      returns list of files in the directory defined by environment variable and a relative path.
      Parameters:
      env -
      rpath -
      Returns:
    • getFileList

      public static List<String> getFileList(String env, String rpath, String ext)
      returns a file list that contains files with given extension
      Parameters:
      env -
      rpath -
      ext -
      Returns:
    • writeFile

      public static void writeFile(String filename, List<String> lines)
    • readFile

      public static List<String> readFile(String filename)
      Reads a text file into a list of strings
      Parameters:
      filename -
      Returns:
    • readFileString

      public static String readFileString(String filename)
      Reads a text file into one string.
      Parameters:
      filename -
      Returns:
    • getFileNamesRelative

      public static List<String> getFileNamesRelative(List<String> files)
      Returs relative paths of file names from list of absolute paths.
      Parameters:
      files -
      Returns:
    • createFileName

      public static String createFileName(String filename, String addition, boolean preservePath)
      returns a new file name which is composed of the file name given and then by adding given string to it. if flag preservePath is true, then file name will have the same path as the original file name.
      Parameters:
      filename -
      addition -
      preservePath -
      Returns:
    • main

      public static void main(String[] args)