Package com.flir.thermalsdk.androidsdk
Class AndroidFilesUtil
java.lang.Object
com.flir.thermalsdk.androidsdk.AndroidFilesUtil
Utility for handling local files on Android platform.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Files list sorting for use withlistFilesUnderDir(String, ListSortFlag)
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
Copies all files from one location to another.static android.graphics.Bitmap
getThumbnail
(android.content.ContentResolver cr, String path) Gets a thumbnail of a graphic file under a specified path.static boolean
isSequenceFile
(String filename) Check whether the provided file name is a valid sequence (.csq or .seq) file.static boolean
isThermalImageFile
(String filename) Check whether the provided file name is a valid thermal image (.jpg) file.static String[]
listFilesUnderDir
(@NotNull String absoluteDirectoryPath) Lists local JPG and CSQ/SEQ files names under specified directory.static String[]
listFilesUnderDir
(@NotNull String absoluteDirectoryPath, @Nullable AndroidFilesUtil.ListSortFlag flag) Lists local JPG and CSQ/SEQ files names under specified directory.static void
Ensures the Android media scanner scans a given file.static void
Ensures the Android media scanner scans a given files.
-
Constructor Details
-
AndroidFilesUtil
public AndroidFilesUtil()
-
-
Method Details
-
listFilesUnderDir
Lists local JPG and CSQ/SEQ files names under specified directory.- Parameters:
absoluteDirectoryPath
- an absolute directory path- Returns:
- Returns an array of JPG and CSQ/SEQ files name under specified directory. May be empty array. May be null if specified directory does not exist of path is not pointing a directory.
-
listFilesUnderDir
public static String[] listFilesUnderDir(@NotNull @NotNull String absoluteDirectoryPath, @Nullable @Nullable AndroidFilesUtil.ListSortFlag flag) Lists local JPG and CSQ/SEQ files names under specified directory.- Parameters:
absoluteDirectoryPath
- an absolute directory pathflag
- aAndroidFilesUtil.ListSortFlag
used for custom list order- Returns:
- Returns an array of JPG and CSQ/SEQ files name under specified directory. May be empty array. May be null if specified directory does not exist of path is not pointing a directory.
-
copyFiles
Copies all files from one location to another.- Parameters:
from
- a source directoryto
- a destination directoryoverride
- if true, then the destination files with the same names as the source files will be overriden, otherwise will be skipped- Returns:
- Returns number of copied files or -1 if error happened.
-
getThumbnail
Gets a thumbnail of a graphic file under a specified path.- Parameters:
cr
- aContentResolver
path
- an absolute directory path- Returns:
- Returns a Bitmap representing an image thumbnail or null if cannot be obtained.
-
scanMedia
Ensures the Android media scanner scans a given file. This method is useful when we want to generate thumbnail for a file later using MediaStore.Images.Media#EXTERNAL_CONTENT_URI.- Parameters:
context
- app contextpath
- absolute path to the file to scan
-
scanMedia
Ensures the Android media scanner scans a given files. This method is useful when we want to generate thumbnail for files later using MediaStore.Images.Media#EXTERNAL_CONTENT_URI.- Parameters:
context
- app contextpaths
- set with the absolute paths to the files to scan
-
isSequenceFile
Check whether the provided file name is a valid sequence (.csq or .seq) file.- Parameters:
filename
- file name, may include path- Returns:
- Returns true if the provided file name is a valid sequence (.csq or .seq) file.
-
isThermalImageFile
Check whether the provided file name is a valid thermal image (.jpg) file.- Parameters:
filename
- file name, may include path- Returns:
- Returns true if the provided file name is a valid thermal image (.jpg) file.
-