Object StreamFileUtil
-
- All Implemented Interfaces:
public class StreamFileUtil
-
-
Field Summary
Fields Modifier and Type Field Description public final static StreamFileUtilINSTANCE
-
Method Summary
Modifier and Type Method Description final UrigetUriForFile(Context context, File file)final UriwriteImageToSharableFile(Context context, Bitmap bitmap)final Result<Unit>clearStreamCache(Context context)Deletes all the content contained within the Stream cache directory. final Result<Uri>getFileFromCache(Context context, Attachment attachment)Fetches the given attachment from cache if it has been previously cached. 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. -
-
Method Detail
-
getUriForFile
final Uri getUriForFile(Context context, File file)
-
writeImageToSharableFile
final Uri writeImageToSharableFile(Context context, Bitmap bitmap)
-
clearStreamCache
final Result<Unit> clearStreamCache(Context context)
Deletes all the content contained within the Stream cache directory.
-
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.
-
-
-
-