MtpObjectInfo
public
final
class
MtpObjectInfo
extends Object
This class encapsulates information about an object on an MTP device. This corresponds to the ObjectInfo Dataset described in section 5.3.1 of the MTP specification.
Summary
Nested classes | |
|---|---|
class |
MtpObjectInfo.Builder
Builds a new object info instance. |
Public methods | |
|---|---|
int
|
getAssociationDesc()
Returns the association description for the MTP object
Will be zero objects that are not of format
|
int
|
getAssociationType()
Returns the association type for the MTP object
Will be zero objects that are not of format
|
int
|
getCompressedSize()
Returns the size of the MTP object |
long
|
getCompressedSizeLong()
Returns the size of the MTP object |
long
|
getDateCreated()
Returns the creation date of the MTP object The value is represented as milliseconds since January 1, 1970 |
long
|
getDateModified()
Returns the modification date of the MTP object The value is represented as milliseconds since January 1, 1970 |
int
|
getFormat()
Returns the format code for the MTP object |
int
|
getImagePixDepth()
Returns the depth of the MTP object in bits per pixel Will be zero for non-image objects |
long
|
getImagePixDepthLong()
Returns the depth of the MTP object in bits per pixel Will be zero for non-image objects |
int
|
getImagePixHeight()
Returns the height of the MTP object in pixels Will be zero for non-image objects |
long
|
getImagePixHeightLong()
Returns the height of the MTP object in pixels Will be zero for non-image objects |
int
|
getImagePixWidth()
Returns the width of the MTP object in pixels Will be zero for non-image objects |
long
|
getImagePixWidthLong()
Returns the width of the MTP object in pixels Will be zero for non-image objects |
String
|
getKeywords()
Returns a comma separated list of keywords for the MTP object |
String
|
getName()
Returns the name of the MTP object |
int
|
getObjectHandle()
Returns the object handle for the MTP object |
int
|
getParent()
Returns the object handle for the object's parent Will be zero for the root directory of a storage unit |
int
|
getProtectionStatus()
Returns the protection status for the MTP object Possible values are: |
int
|
getSequenceNumber()
Returns the sequence number for the MTP object This field is typically not used for MTP devices, but is sometimes used to define a sequence of photos on PTP cameras. |
long
|
getSequenceNumberLong()
Returns the sequence number for the MTP object This field is typically not used for MTP devices, but is sometimes used to define a sequence of photos on PTP cameras. |
int
|
getStorageId()
Returns the storage ID for the MTP object's storage unit |
int
|
getThumbCompressedSize()
Returns the size of the MTP object's thumbnail Will be zero for objects with no thumbnail |
long
|
getThumbCompressedSizeLong()
Returns the size of the MTP object's thumbnail Will be zero for objects with no thumbnail |
int
|
getThumbFormat()
Returns the format code for the MTP object's thumbnail Will be zero for objects with no thumbnail |
int
|
getThumbPixHeight()
Returns the height of the MTP object's thumbnail in pixels Will be zero for objects with no thumbnail |
long
|
getThumbPixHeightLong()
Returns the height of the MTP object's thumbnail in pixels Will be zero for objects with no thumbnail |
int
|
getThumbPixWidth()
Returns the width of the MTP object's thumbnail in pixels Will be zero for objects with no thumbnail |
long
|
getThumbPixWidthLong()
Returns the width of the MTP object's thumbnail in pixels Will be zero for objects with no thumbnail |
Inherited methods | |
|---|---|
Public methods
getAssociationDesc
public int getAssociationDesc ()
Returns the association description for the MTP object
Will be zero objects that are not of format
MtpConstants.FORMAT_ASSOCIATION
| Returns | |
|---|---|
int |
the object's association description |
getAssociationType
public int getAssociationType ()
Returns the association type for the MTP object
Will be zero objects that are not of format
MtpConstants.FORMAT_ASSOCIATION
For directories the association type is typically
MtpConstants.ASSOCIATION_TYPE_GENERIC_FOLDER
| Returns | |
|---|---|
int |
the object's association type |
getCompressedSize
public int getCompressedSize ()
Returns the size of the MTP object
| Returns | |
|---|---|
int |
the object size |
getCompressedSizeLong
public long getCompressedSizeLong ()
Returns the size of the MTP object
| Returns | |
|---|---|
long |
the object size |
getDateCreated
public long getDateCreated ()
Returns the creation date of the MTP object The value is represented as milliseconds since January 1, 1970
| Returns | |
|---|---|
long |
the object's creation date |
getDateModified
public long getDateModified ()
Returns the modification date of the MTP object The value is represented as milliseconds since January 1, 1970
| Returns | |
|---|---|
long |
the object's modification date |
getFormat
public int getFormat ()
Returns the format code for the MTP object
| Returns | |
|---|---|
int |
the format code |
getImagePixDepth
public int getImagePixDepth ()
Returns the depth of the MTP object in bits per pixel Will be zero for non-image objects
| Returns | |
|---|---|
int |
the image depth |
getImagePixDepthLong
public long getImagePixDepthLong ()
Returns the depth of the MTP object in bits per pixel Will be zero for non-image objects
| Returns | |
|---|---|
long |
the image depth |
getImagePixHeight
public int getImagePixHeight ()
Returns the height of the MTP object in pixels Will be zero for non-image objects
| Returns | |
|---|---|
int |
the image height |
getImagePixHeightLong
public long getImagePixHeightLong ()
Returns the height of the MTP object in pixels Will be zero for non-image objects
| Returns | |
|---|---|
long |
the image height |
getImagePixWidth
public int getImagePixWidth ()
Returns the width of the MTP object in pixels Will be zero for non-image objects
| Returns | |
|---|---|
int |
the image width |
getImagePixWidthLong
public long getImagePixWidthLong ()
Returns the width of the MTP object in pixels Will be zero for non-image objects
| Returns | |
|---|---|
long |
the image width |
getKeywords
public String getKeywords ()
Returns a comma separated list of keywords for the MTP object
| Returns | |
|---|---|
String |
the object's keyword list.
This value cannot be null. |
getName
public String getName ()
Returns the name of the MTP object
| Returns | |
|---|---|
String |
the object's name.
This value cannot be null. |
getObjectHandle
public int getObjectHandle ()
Returns the object handle for the MTP object
| Returns | |
|---|---|
int |
the object handle |
getParent
public int getParent ()
Returns the object handle for the object's parent Will be zero for the root directory of a storage unit
| Returns | |
|---|---|
int |
the object's parent |
getProtectionStatus
public int getProtectionStatus ()
Returns the protection status for the MTP object Possible values are:
-
MtpConstants.PROTECTION_STATUS_NONE -
MtpConstants.PROTECTION_STATUS_READ_ONLY -
MtpConstants.PROTECTION_STATUS_NON_TRANSFERABLE_DATA
| Returns | |
|---|---|
int |
the protection status |
getSequenceNumber
public int getSequenceNumber ()
Returns the sequence number for the MTP object This field is typically not used for MTP devices, but is sometimes used to define a sequence of photos on PTP cameras.
| Returns | |
|---|---|
int |
the object's sequence number |
getSequenceNumberLong
public long getSequenceNumberLong ()
Returns the sequence number for the MTP object This field is typically not used for MTP devices, but is sometimes used to define a sequence of photos on PTP cameras.
| Returns | |
|---|---|
long |
the object's sequence number |
getStorageId
public int getStorageId ()
Returns the storage ID for the MTP object's storage unit
| Returns | |
|---|---|
int |
the storage ID |
getThumbCompressedSize
public int getThumbCompressedSize ()
Returns the size of the MTP object's thumbnail Will be zero for objects with no thumbnail
| Returns | |
|---|---|
int |
the thumbnail size |
getThumbCompressedSizeLong
public long getThumbCompressedSizeLong ()
Returns the size of the MTP object's thumbnail Will be zero for objects with no thumbnail
| Returns | |
|---|---|
long |
the thumbnail size |
getThumbFormat
public int getThumbFormat ()
Returns the format code for the MTP object's thumbnail Will be zero for objects with no thumbnail
| Returns | |
|---|---|
int |
the thumbnail format code |
getThumbPixHeight
public int getThumbPixHeight ()
Returns the height of the MTP object's thumbnail in pixels Will be zero for objects with no thumbnail
| Returns | |
|---|---|
int |
the thumbnail height |
getThumbPixHeightLong
public long getThumbPixHeightLong ()
Returns the height of the MTP object's thumbnail in pixels Will be zero for objects with no thumbnail
| Returns | |
|---|---|
long |
the thumbnail height |
getThumbPixWidth
public int getThumbPixWidth ()
Returns the width of the MTP object's thumbnail in pixels Will be zero for objects with no thumbnail
| Returns | |
|---|---|
int |
the thumbnail width |
getThumbPixWidthLong
public long getThumbPixWidthLong ()
Returns the width of the MTP object's thumbnail in pixels Will be zero for objects with no thumbnail
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 2026-08-03 UTC.
