File.UsableSpace Property

Definition

Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname.

public virtual long UsableSpace { [Android.Runtime.Register("getUsableSpace", "()J", "GetGetUsableSpaceHandler")] get; }
[<get: Android.Runtime.Register("getUsableSpace", "()J", "GetGetUsableSpaceHandler")>]
member this.UsableSpace : int64

Property Value

The number of available bytes on the partition or 0L if the abstract pathname does not name a partition. On systems where this information is not available, this method will be equivalent to a call to #getFreeSpace.

Attributes

Remarks

Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname. When possible, this method checks for write permissions and other operating system restrictions and will therefore usually provide a more accurate estimate of how much new data can actually be written than #getFreeSpace.

The returned number of available bytes is a hint, but not a guarantee, that it is possible to use most or any of these bytes. The number of unallocated bytes is most likely to be accurate immediately after this call. It is likely to be made inaccurate by any external I/O operations including those made on the system outside of this virtual machine. This method makes no guarantee that write operations to this file system will succeed.

On Android (and other Unix-based systems), this method returns the number of free bytes available to non-root users, regardless of whether you're actually running as root, and regardless of any quota or other restrictions that might apply to the user. (The getFreeSpace method returns the number of bytes potentially available to root.)

Added in 1.6.

Java documentation for java.io.File.getUsableSpace().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to