@Implements(value=android.os.StatFs.class) public class ShadowStatFs extends Object
Robolectic doesn’t provide actual filesystem stats; rather, it provides the ability to specify stats values in advance.
registerStats(File, int, int, int)
Modifier and Type | Field and Description |
---|---|
static int |
BLOCK_SIZE |
Constructor and Description |
---|
ShadowStatFs() |
Modifier and Type | Method and Description |
---|---|
protected void |
__constructor__(String path) |
protected int |
getAvailableBlocks() |
protected long |
getAvailableBlocksLong() |
protected long |
getAvailableBytes() |
protected int |
getBlockCount() |
protected long |
getBlockCountLong() |
protected int |
getBlockSize() |
protected long |
getBlockSizeLong()
Robolectric always uses a block size of
4096 . |
protected int |
getFreeBlocks() |
protected long |
getFreeBlocksLong() |
protected long |
getFreeBytes() |
protected long |
getTotalBytes() |
static void |
registerStats(File path,
int blockCount,
int freeBlocks,
int availableBlocks)
Register stats for a path, which will be used when a matching
StatFs instance is created. |
static void |
registerStats(String path,
int blockCount,
int freeBlocks,
int availableBlocks)
Register stats for a path, which will be used when a matching
StatFs instance is created. |
static void |
reset() |
protected void |
restat(String path) |
public static final int BLOCK_SIZE
@Implementation protected void __constructor__(String path)
@Implementation protected int getBlockSize()
@Implementation protected int getBlockCount()
@Implementation protected int getFreeBlocks()
@Implementation(minSdk=18) protected long getFreeBlocksLong()
@Implementation(minSdk=18) protected long getFreeBytes()
@Implementation(minSdk=18) protected long getAvailableBytes()
@Implementation(minSdk=18) protected long getTotalBytes()
@Implementation protected int getAvailableBlocks()
@Implementation protected void restat(String path)
@Implementation(minSdk=18) protected long getBlockSizeLong()
Robolectric always uses a block size of 4096
.
@Implementation(minSdk=18) protected long getBlockCountLong()
@Implementation(minSdk=18) protected long getAvailableBlocksLong()
public static void registerStats(File path, int blockCount, int freeBlocks, int availableBlocks)
Register stats for a path, which will be used when a matching StatFs
instance is created.
path
- path to the fileblockCount
- number of blocksfreeBlocks
- number of free blocksavailableBlocks
- number of available blockspublic static void registerStats(String path, int blockCount, int freeBlocks, int availableBlocks)
Register stats for a path, which will be used when a matching StatFs
instance is created. A StatFs
instance matches if it extends path. If several registered paths match, we pick the longest one.
path
- path to the fileblockCount
- number of blocksfreeBlocks
- number of free blocksavailableBlocks
- number of available blocks@Resetter public static void reset()