public final class DataUsage extends Object
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static MountState |
getDiskMountedStatus() |
Queries the mount state of the primary device.
|
static MountState |
getDiskMountedStatus(File path) |
Queries the mount state of the device that houses a specified file path.
|
static Optional<Volume> |
getVolume(File file) |
Obtains the device volume that houses a specified file path.
|
static Optional<Volume> |
getVolume(Context context,
Uri uri) |
Obtains the device volume with a specified URI.
|
static Optional<List<Volume>> |
getVolumes() |
Obtains the list of all available device volumes.
|
static boolean |
isDiskEmulated() |
Checks whether the primary device is emulated.
|
static boolean |
isDiskEmulated(File path) |
Checks whether the device that houses the specified file path is emulated.
|
static boolean |
isDiskPluggable() |
Checks whether the primary device is pluggable.
|
static boolean |
isDiskPluggable(File path) |
Checks whether the device that houses a specified file path is pluggable.
|
static boolean |
isSupported() |
Checks whether DataUsage is supported on current device.
|
public static boolean isSupported()
true if DataUsage is supported on current device; returns
false otherwise.public static MountState getDiskMountedStatus()
MountState, which indicates the mount state of the primary device.public static MountState getDiskMountedStatus(File path)
path - Indicates the specified file path.MountState, which indicates the mount state of the
device that houses the specified file path.public static boolean isDiskPluggable()
true if the primary device is pluggable; returns
false otherwise.public static boolean isDiskPluggable(File path)
path - Indicates the specified file path.true if the device is pluggable; returns
false otherwise.public static Optional<List<Volume>> getVolumes()
public static Optional<Volume> getVolume(File file)
file - Indicates the specified file path.public static Optional<Volume> getVolume(Context context, Uri uri)
context - Indicates the application context.uri - Indicates the specified URI, which must be of the multimedia
type. The current application must have the permission to
access the URI.public static boolean isDiskEmulated()
true if the primary device is emulated; returns false otherwise.public static boolean isDiskEmulated(File path)
path - Indicates the file path.true if the device is emulated; returns false otherwise.