to top
Android APIs
public class

StatFs

extends Object
java.lang.Object
   ↳ android.os.StatFs

Class Overview

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

Summary

Public Constructors

? Examples
StatFs( String path)
Construct a new StatFs for looking at the stats of the filesystem at path.
Public Methods

? Examples
int getAvailableBlocks()
The number of blocks that are free on the file system and available to applications.

? Examples
int getBlockCount()
The total number of blocks on the file system.

? Examples
int getBlockSize()
The size, in bytes, of a block on the file system.

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

? Examples
void restat( String path)
Perform a restat of the file system referenced by this object.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public StatFs (String path)

Added in API level 1

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 path in the desired file system to stat.

Public Methods

public int getAvailableBlocks ()

Added in API level 1

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

public int getBlockCount ()

Added in API level 1

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

public int getBlockSize ()

Added in API level 1

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

public int getFreeBlocks ()

Added in API level 1

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 statfs.f_bfree field. Most applications will want to use getAvailableBlocks() instead.

public void restat (String path)

Added in API level 1

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.

No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.