Stay organized with collections
Save and categorize content based on your preferences.
MtpStorageInfo
public
final
class
MtpStorageInfo
extends Object
This class encapsulates information about a storage unit on an MTP device.
This corresponds to the StorageInfo Dataset described in
section 5.2.2 of the MTP specification.
Summary
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object.
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public methods
getDescription
public String getDescription ()
Returns the description string for the storage unit.
This is typically displayed to the user in the user interface on the
MTP host.
| Returns |
String |
the storage unit description
This value cannot be null. |
getFreeSpace
public long getFreeSpace ()
Returns the amount of free space in the storage unit in bytes
| Returns |
long |
the amount of free space |
getMaxCapacity
public long getMaxCapacity ()
Returns the maximum storage capacity for the storage unit in bytes
| Returns |
long |
the maximum capacity |
getStorageId
public int getStorageId ()
Returns the storage ID for the storage unit.
The storage ID uniquely identifies the storage unit on the MTP device.
| Returns |
int |
the storage ID |
getVolumeIdentifier
public String getVolumeIdentifier ()
Returns the volume identifier for the storage unit
| Returns |
String |
the storage volume identifier
This value cannot be null. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MtpStorageInfo\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nMtpStorageInfo\n==============\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/mtp/MtpStorageInfo \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\nfinal\n\nclass\nMtpStorageInfo\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|----------------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | android.mtp.MtpStorageInfo |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThis class encapsulates information about a storage unit on an MTP device.\nThis corresponds to the StorageInfo Dataset described in\nsection 5.2.2 of the MTP specification.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` `[String](/reference/java/lang/String) | ` `[getDescription](/reference/android/mtp/MtpStorageInfo#getDescription())`() ` Returns the description string for the storage unit. |\n| ` long` | ` `[getFreeSpace](/reference/android/mtp/MtpStorageInfo#getFreeSpace())`() ` Returns the amount of free space in the storage unit in bytes |\n| ` long` | ` `[getMaxCapacity](/reference/android/mtp/MtpStorageInfo#getMaxCapacity())`() ` Returns the maximum storage capacity for the storage unit in bytes |\n| ` int` | ` `[getStorageId](/reference/android/mtp/MtpStorageInfo#getStorageId())`() ` Returns the storage ID for the storage unit. |\n| ` `[String](/reference/java/lang/String) | ` `[getVolumeIdentifier](/reference/android/mtp/MtpStorageInfo#getVolumeIdentifier())`() ` Returns the volume identifier for the storage unit |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final `[Class](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nPublic methods\n--------------\n\n### getDescription\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic String getDescription ()\n```\n\nReturns the description string for the storage unit.\nThis is typically displayed to the user in the user interface on the\nMTP host.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------------------------------------|------------------------------------------------------------------|\n| [String](/reference/java/lang/String) | the storage unit description This value cannot be `null`. \u003cbr /\u003e |\n\n### getFreeSpace\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic long getFreeSpace ()\n```\n\nReturns the amount of free space in the storage unit in bytes\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------|---------------------------------|\n| `long` | the amount of free space \u003cbr /\u003e |\n\n### getMaxCapacity\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic long getMaxCapacity ()\n```\n\nReturns the maximum storage capacity for the storage unit in bytes\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------|-----------------------------|\n| `long` | the maximum capacity \u003cbr /\u003e |\n\n### getStorageId\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic int getStorageId ()\n```\n\nReturns the storage ID for the storage unit.\nThe storage ID uniquely identifies the storage unit on the MTP device.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------|-----------------------|\n| `int` | the storage ID \u003cbr /\u003e |\n\n### getVolumeIdentifier\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic String getVolumeIdentifier ()\n```\n\nReturns the volume identifier for the storage unit\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------------------------------------|-------------------------------------------------------------------|\n| [String](/reference/java/lang/String) | the storage volume identifier This value cannot be `null`. \u003cbr /\u003e |"]]