Class AndroidFilesUtil

java.lang.Object
com.flir.thermalsdk.androidsdk.AndroidFilesUtil

public class AndroidFilesUtil extends Object
Utility for handling local files on Android platform.
  • Constructor Details

    • AndroidFilesUtil

      public AndroidFilesUtil()
  • Method Details

    • listFilesUnderDir

      public static String[] listFilesUnderDir(@NotNull @NotNull String absoluteDirectoryPath)
      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 path
      flag - a AndroidFilesUtil.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

      public static int copyFiles(String from, String to, boolean override)
      Copies all files from one location to another.
      Parameters:
      from - a source directory
      to - a destination directory
      override - 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

      public static android.graphics.Bitmap getThumbnail(android.content.ContentResolver cr, String path)
      Gets a thumbnail of a graphic file under a specified path.
      Parameters:
      cr - a ContentResolver
      path - an absolute directory path
      Returns:
      Returns a Bitmap representing an image thumbnail or null if cannot be obtained.
    • scanMedia

      public static void scanMedia(android.content.Context context, String path)
      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 context
      path - absolute path to the file to scan
    • scanMedia

      public static void scanMedia(android.content.Context context, Set<String> paths)
      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 context
      paths - set with the absolute paths to the files to scan
    • isSequenceFile

      public static boolean isSequenceFile(String filename)
      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

      public static boolean isThermalImageFile(String filename)
      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.