Object StreamFileUtil

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • clearStreamCache

         final Result<Unit> clearStreamCache(Context context)

        Deletes all the content contained within the Stream cache directory.

        Parameters:
        context - The Context necessary to perform file operations.
        Returns:

        Returns a Result. If the action was successful Result.Success will contain Unit, otherwise Result.Failure will contain a Error.

      • getFileFromCache

         final Result<Uri> getFileFromCache(Context context, Attachment attachment)

        Fetches the given attachment from cache if it has been previously cached. Returns an error otherwise.

        Parameters:
        context - The Android Context used for path resolving and Uri fetching.
        attachment - the attachment to be downloaded.
        Returns:

        A Uri to the file is returned in the form of Result.Success if the file was successfully fetched from the cache. Returns a Error accessible via Result.Failure otherwise.

      • writeFileToShareableFile

         final Result<Uri> writeFileToShareableFile(Context context, Attachment attachment)

        Hashes the links of given attachments and then tries to create a new file under that hash. If the file already exists checks that the full file has been written and shares it if it has, in other cases downloads the file and writes it.

        Parameters:
        context - The Android Context used for path resolving and Uri fetching.
        attachment - the attachment to be downloaded.
        Returns:

        Returns a Result. If the action was successful Result.Success will contain a Uri pointing to the file, otherwise Result.Failure will contain a Error.