Home | History | Annotate | Download | only in mtp
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.mtp;
     18 
     19 import android.annotation.NonNull;
     20 
     21 /**
     22  * This class encapsulates information about a storage unit on an MTP device.
     23  * This corresponds to the StorageInfo Dataset described in
     24  * section 5.2.2 of the MTP specification.
     25  */
     26 public final class MtpStorageInfo {
     27 
     28     private int mStorageId;
     29     private long mMaxCapacity;
     30     private long mFreeSpace;
     31     private String mDescription;
     32     private String mVolumeIdentifier;
     33 
     34     // only instantiated via JNI
     35     private MtpStorageInfo() {
     36     }
     37 
     38     /**
     39      * Returns the storage ID for the storage unit.
     40      * The storage ID uniquely identifies the storage unit on the MTP device.
     41      *
     42      * @return the storage ID
     43      */
     44     public final int getStorageId() {
     45         return mStorageId;
     46     }
     47 
     48     /**
     49      * Returns the maximum storage capacity for the storage unit in bytes
     50      *
     51      * @return the maximum capacity
     52      */
     53     public final long getMaxCapacity() {
     54         return mMaxCapacity;
     55     }
     56 
     57    /**
     58      * Returns the amount of free space in the storage unit in bytes
     59      *
     60      * @return the amount of free space
     61      */
     62     public final long getFreeSpace() {
     63         return mFreeSpace;
     64     }
     65 
     66    /**
     67      * Returns the description string for the storage unit.
     68      * This is typically displayed to the user in the user interface on the
     69      * MTP host.
     70      *
     71      * @return the storage unit description
     72      */
     73     public final @NonNull String getDescription() {
     74         return mDescription;
     75     }
     76 
     77    /**
     78      * Returns the volume identifier for the storage unit
     79      *
     80      * @return the storage volume identifier
     81      */
     82     public final @NonNull String getVolumeIdentifier() {
     83         return mVolumeIdentifier;
     84     }
     85 }
     86