public final class FileStorageService
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FileStorageService.FileMetadata
Represents the metadata of a file
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MODEL_EXTENSION |
static java.lang.String |
STORAGE_PATH |
Modifier and Type | Method and Description |
---|---|
static byte[] |
getBytes(android.net.Uri uri)
Read raw bytes from a given uri
|
static java.io.File |
getFile(android.net.Uri uri)
Gets a file handle based off a uri
|
static FileStorageService.FileMetadata |
getFileMetadata(android.net.Uri uri)
Retrieves file metadata
|
static FileStorageService.FileMetadata |
getFileMetadata(android.net.Uri uri,
android.content.ContentResolver contentResolver)
Retrieves file metadata
|
static java.util.List<java.io.File> |
write(java.util.List<FileDto> fileDtos)
Writes a list of
FileDto s to external storage |
public static final java.lang.String MODEL_EXTENSION
public static final java.lang.String STORAGE_PATH
public static java.util.List<java.io.File> write(java.util.List<FileDto> fileDtos) throws java.io.IOException
FileDto
s to external storagefileDtos
- the file data transfer objects to serialize; may not be null
java.lang.NullPointerException
- if fileDtos
is null
java.io.IOException
- if an error occurred while trying to serialize the datapublic static FileStorageService.FileMetadata getFileMetadata(android.net.Uri uri) throws java.io.IOException
uri
- the uri of the file; may not be null
null
java.io.IOException
- if an error occurred while accessing the filejava.lang.NullPointerException
- if uri
was nullpublic static FileStorageService.FileMetadata getFileMetadata(android.net.Uri uri, android.content.ContentResolver contentResolver) throws java.io.IOException
uri
- the uri of the file; may not be nullcontentResolver
- the ContentResolver
used to retrieve the metadata; may not be
nulljava.lang.NullPointerException
- if uri
or contentResolver
is null
java.io.IOException
- if an error occurred while accessing the filepublic static java.io.File getFile(android.net.Uri uri) throws java.io.IOException
uri
- the uri of the file; may not be null
null
if unable to construct the file from the given uri
java.lang.NullPointerException
- if uri
was null
java.io.IOException
- if unable to construct the file objectpublic static byte[] getBytes(android.net.Uri uri) throws java.io.IOException
uri
- the uri of a resource to read; may not be null
java.io.IOException
- if unable to read the urijava.lang.NullPointerException
- if uri
was null