Skip to content

Most visited

Recently visited

navigation
Added in API level 1

StatFs

public class StatFs
extends Object

java.lang.Object
   ↳ android.os.StatFs


Retrieve overall information about the space on a filesystem. This is a wrapper for Unix statvfs().

Summary

Public constructors

StatFs(String path)

Construct a new StatFs for looking at the stats of the filesystem at path.

Public methods

int getAvailableBlocks()

This method was deprecated in API level 18. Use getAvailableBlocksLong() instead.

long getAvailableBlocksLong()

The number of blocks that are free on the file system and available to applications.

long getAvailableBytes()

The number of bytes that are free on the file system and available to applications.

int getBlockCount()

This method was deprecated in API level 18. Use getBlockCountLong() instead.

long getBlockCountLong()

The total number of blocks on the file system.

int getBlockSize()

This method was deprecated in API level 18. Use getBlockSizeLong() instead.

long getBlockSizeLong()

The size, in bytes, of a block on the file system.

int getFreeBlocks()

This method was deprecated in API level 18. Use getFreeBlocksLong() instead.

long getFreeBlocksLong()

The total number of blocks that are free on the file system, including reserved blocks (that are not available to normal applications).

long getFreeBytes()

The number of bytes that are free on the file system, including reserved blocks (that are not available to normal applications).

long getTotalBytes()

The total number of bytes supported by the file system.

void restat(String path)

Perform a restat of the file system referenced by this object.

Inherited methods

From class java.lang.Object

Public constructors

StatFs

Added in API level 1
StatFs (String path)

Construct a new StatFs for looking at the stats of the filesystem at path. Upon construction, the stat of the file system will be performed, and the values retrieved available from the methods on this class.

Parameters
path String: path in the desired file system to stat.

Public methods

getAvailableBlocks

Added in API level 1
int getAvailableBlocks ()

This method was deprecated in API level 18.
Use getAvailableBlocksLong() instead.

Returns
int

getAvailableBlocksLong

Added in API level 18
long getAvailableBlocksLong ()

The number of blocks that are free on the file system and available to applications. This corresponds to the Unix statvfs.f_bavail field.

Returns
long

getAvailableBytes

Added in API level 18
long getAvailableBytes ()

The number of bytes that are free on the file system and available to applications.

Returns
long

getBlockCount

Added in API level 1
int getBlockCount ()

This method was deprecated in API level 18.
Use getBlockCountLong() instead.

Returns
int

getBlockCountLong

Added in API level 18
long getBlockCountLong ()

The total number of blocks on the file system. This corresponds to the Unix statvfs.f_blocks field.

Returns
long

getBlockSize

Added in API level 1
int getBlockSize ()

This method was deprecated in API level 18.
Use getBlockSizeLong() instead.

Returns
int

getBlockSizeLong

Added in API level 18
long getBlockSizeLong ()

The size, in bytes, of a block on the file system. This corresponds to the Unix statvfs.f_bsize field.

Returns
long

getFreeBlocks

Added in API level 1
int getFreeBlocks ()

This method was deprecated in API level 18.
Use getFreeBlocksLong() instead.

Returns
int

getFreeBlocksLong

Added in API level 18
long getFreeBlocksLong ()

The total number of blocks that are free on the file system, including reserved blocks (that are not available to normal applications). This corresponds to the Unix statvfs.f_bfree field. Most applications will want to use getAvailableBlocks() instead.

Returns
long

getFreeBytes

Added in API level 18
long getFreeBytes ()

The number of bytes that are free on the file system, including reserved blocks (that are not available to normal applications). Most applications will want to use getAvailableBytes() instead.

Returns
long

getTotalBytes

Added in API level 18
long getTotalBytes ()

The total number of bytes supported by the file system.

Returns
long

restat

Added in API level 1
void restat (String path)

Perform a restat of the file system referenced by this object. This is the same as re-constructing the object with the same file system path, and the new stat values are available upon return.

Parameters
path String
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.