Package PamUtils

Class FileFunctions

java.lang.Object
PamUtils.FileFunctions

public class FileFunctions extends Object
Functions connected with storing data files.
Author:
Doug Gillespie
  • Constructor Details

    • FileFunctions

      public FileFunctions()
  • Method Details

    • getStorageFileFolder

      public static File getStorageFileFolder(String base, long timeMillis, boolean datedSubFolders, boolean autoCreate)
      Get and create a folder for output file storage.
      Parameters:
      base - base name for folder system
      timeMillis - current time in millis
      datedSubFolders - whether the returned name should include a sub folder
      autoCreate - whether the folder should eb created if it doesn't exist.
      Returns:
      new folder name, or null if autocreate is set and the folder couldn't be created.
    • createNonIndexedFolder

      public static File createNonIndexedFolder(String path)
      Create a folder that is not indexed by the Windows indexing system.
      Parameters:
      path - the full path of the folder to create
      Returns:
      the new folder, or null if something went wrong with the folder creation. Note that if setting the non-indexing bit did not work, the new folder will still be returned
    • isWindows

      public static boolean isWindows()
    • setNonIndexingBit

      public static boolean setNonIndexingBit(File file)
      Tell Windows not to index the file/folder passed to this method. This uses jna functions to access the file/folder attributes. Thanks to StackOverflow user Boann for the basic jna code he posted here:
      https://stackoverflow.com/questions/19401889/java-ntfs-compression-attribute
      Like compression, indexing is also one of the NTFS attributes and not visible through the java.nio file/folder methods.

      Note that if this method fails, there is no

      Parameters:
      file - the file or folder to set the bit on
      Returns:
      whether or not the operation was a success
    • isNotIndexed

      public static boolean isNotIndexed(File file) throws Exception
      Throws:
      Exception