Module com.gluonhq.attach.storage
Package com.gluonhq.attach.storage.impl
Class AndroidStorageService
java.lang.Object
com.gluonhq.attach.storage.impl.AndroidStorageService
- All Implemented Interfaces:
StorageService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet a storage directory that is private to the environment that is calling this method.getPublicStorage
(String subdirectory) Get a public storage directory location.boolean
Checks if external storage is available for read access.boolean
Checks if external storage is available for read and write access.
-
Constructor Details
-
AndroidStorageService
public AndroidStorageService()
-
-
Method Details
-
getPrivateStorage
Description copied from interface:StorageService
Get a storage directory that is private to the environment that is calling this method. In the case of iOS or Android, the returned directory is private to the enclosing application.- Specified by:
getPrivateStorage
in interfaceStorageService
- Returns:
- an optional with a private storage directory for an application
-
getPublicStorage
Description copied from interface:StorageService
Get a public storage directory location.Note that on Android the public location could be mapped to a removable memory device and may not always be available. Users of this method are advised to call
StorageService.isExternalStorageWritable()
orStorageService.isExternalStorageReadable()
to avoid surprises.Note also that on Android, permissions will need to be set to access external storage. See: https://developer.android.com/training/basics/data-storage/files.html.
- Specified by:
getPublicStorage
in interfaceStorageService
- Parameters:
subdirectory
- under the root of public storage that is required. On Android the supplied subdirectory should not be null.- Returns:
- an Optional of a File representing the requested directory location. The location may not yet exist. It is the responsibility of the programmer to ensure that the location exists before using it.
-
isExternalStorageWritable
public boolean isExternalStorageWritable()Description copied from interface:StorageService
Checks if external storage is available for read and write access.- Specified by:
isExternalStorageWritable
in interfaceStorageService
- Returns:
- true if the externalStorage is writable (implies readable), false otherwise
-
isExternalStorageReadable
public boolean isExternalStorageReadable()Description copied from interface:StorageService
Checks if external storage is available for read access.- Specified by:
isExternalStorageReadable
in interfaceStorageService
- Returns:
- true if the externalStorage is at least readable, false otherwise
-