Package PamUtils
Class FileFunctions
java.lang.Object
PamUtils.FileFunctions
Functions connected with storing data files.
- Author:
- Doug Gillespie
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic File
createNonIndexedFolder
(String path) Create a folder that is not indexed by the Windows indexing system.static File
getStorageFileFolder
(String base, long timeMillis, boolean datedSubFolders, boolean autoCreate) Get and create a folder for output file storage.static boolean
isNotIndexed
(File file) static boolean
static boolean
setNonIndexingBit
(File file) Tell Windows not to index the file/folder passed to this method.
-
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 systemtimeMillis
- current time in millisdatedSubFolders
- whether the returned name should include a sub folderautoCreate
- 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
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
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
- Throws:
Exception
-