# StatFs

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/os/StatFs#pubctors)\|[Methods](https://developer.android.com/reference/android/os/StatFs#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/os/StatFs#inhmethods)  

# StatFs

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/os/StatFs "View this page in Kotlin")\|Java

`
public


class
StatFs
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.os.StatFs |

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                   ### Public constructors                                                                                                                    ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[StatFs](https://developer.android.com/reference/android/os/StatFs#StatFs(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` path) ` Construct a new StatFs for looking at the stats of the filesystem at`path`. |

|                                                                                                                                      ### Public methods                                                                                                                                       ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`  | ` `[getAvailableBlocks](https://developer.android.com/reference/android/os/StatFs#getAvailableBlocks())`() ` *This method was deprecated in API level 18. Use[getAvailableBlocksLong()](https://developer.android.com/reference/android/os/StatFs#getAvailableBlocksLong())instead.* |
| ` long` | ` `[getAvailableBlocksLong](https://developer.android.com/reference/android/os/StatFs#getAvailableBlocksLong())`() ` The number of blocks that are free on the file system and available to applications.                                                                            |
| ` long` | ` `[getAvailableBytes](https://developer.android.com/reference/android/os/StatFs#getAvailableBytes())`() ` The number of bytes that are free on the file system and available to applications.                                                                                       |
| ` int`  | ` `[getBlockCount](https://developer.android.com/reference/android/os/StatFs#getBlockCount())`() ` *This method was deprecated in API level 18. Use[getBlockCountLong()](https://developer.android.com/reference/android/os/StatFs#getBlockCountLong())instead.*                     |
| ` long` | ` `[getBlockCountLong](https://developer.android.com/reference/android/os/StatFs#getBlockCountLong())`() ` The total number of blocks on the file system.                                                                                                                            |
| ` int`  | ` `[getBlockSize](https://developer.android.com/reference/android/os/StatFs#getBlockSize())`() ` *This method was deprecated in API level 18. Use[getBlockSizeLong()](https://developer.android.com/reference/android/os/StatFs#getBlockSizeLong())instead.*                         |
| ` long` | ` `[getBlockSizeLong](https://developer.android.com/reference/android/os/StatFs#getBlockSizeLong())`() ` The size, in bytes, of a block on the file system.                                                                                                                          |
| ` int`  | ` `[getFreeBlocks](https://developer.android.com/reference/android/os/StatFs#getFreeBlocks())`() ` *This method was deprecated in API level 18. Use[getFreeBlocksLong()](https://developer.android.com/reference/android/os/StatFs#getFreeBlocksLong())instead.*                     |
| ` long` | ` `[getFreeBlocksLong](https://developer.android.com/reference/android/os/StatFs#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](https://developer.android.com/reference/android/os/StatFs#getFreeBytes())`() ` The number of bytes that are free on the file system, including reserved blocks (that are not available to normal applications).                                                    |
| ` long` | ` `[getTotalBytes](https://developer.android.com/reference/android/os/StatFs#getTotalBytes())`() ` The total number of bytes supported by the file system.                                                                                                                           |
| ` void` | ` `[restat](https://developer.android.com/reference/android/os/StatFs#restat(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` path) ` Perform a restat of the file system referenced by this object.                                         |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### StatFs

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public 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.

<br />

|                            Parameters                             ||
|--------|-----------------------------------------------------------|
| `path` | `String`: path in the desired file system to stat. <br /> |

|                                                                 Throws                                                                  ||
|--------------------------------------------------------------------------------------------------------|---------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the file system access fails |

## Public methods

### getAvailableBlocks

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getAvailableBlocks ()
```

<br />

**This method was deprecated in API level 18.**   
Use[getAvailableBlocksLong()](https://developer.android.com/reference/android/os/StatFs#getAvailableBlocksLong())instead.

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getAvailableBlocksLong

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public 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.

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getAvailableBytes

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long getAvailableBytes ()
```

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

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getBlockCount

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getBlockCount ()
```

<br />

**This method was deprecated in API level 18.**   
Use[getBlockCountLong()](https://developer.android.com/reference/android/os/StatFs#getBlockCountLong())instead.

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getBlockCountLong

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long getBlockCountLong ()
```

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

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getBlockSize

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getBlockSize ()
```

<br />

**This method was deprecated in API level 18.**   
Use[getBlockSizeLong()](https://developer.android.com/reference/android/os/StatFs#getBlockSizeLong())instead.

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getBlockSizeLong

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long getBlockSizeLong ()
```

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

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getFreeBlocks

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getFreeBlocks ()
```

<br />

**This method was deprecated in API level 18.**   
Use[getFreeBlocksLong()](https://developer.android.com/reference/android/os/StatFs#getFreeBlocksLong())instead.

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getFreeBlocksLong

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public 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[getAvailableBlocksLong()](https://developer.android.com/reference/android/os/StatFs#getAvailableBlocksLong())instead.

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getFreeBytes

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public 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()](https://developer.android.com/reference/android/os/StatFs#getAvailableBytes())instead.

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getTotalBytes

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long getTotalBytes ()
```

The total number of bytes supported by the file system.

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### restat

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public 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.

<br />

|       Parameters        ||
|--------|-----------------|
| `path` | `String` <br /> |

|                                                                 Throws                                                                  ||
|--------------------------------------------------------------------------------------------------------|---------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the file system access fails |