Package org.robolectric.shadows
Class ShadowStatFs
- java.lang.Object
-
- org.robolectric.shadows.ShadowStatFs
-
@Implements(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.- See Also:
registerStats(File, int, int, int)
-
-
Field Summary
Fields Modifier and Type Field Description static intBLOCK_SIZE
-
Constructor Summary
Constructors Constructor Description ShadowStatFs()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void__constructor__(String path)protected intgetAvailableBlocks()protected longgetAvailableBlocksLong()protected longgetAvailableBytes()protected intgetBlockCount()protected longgetBlockCountLong()protected intgetBlockSize()protected longgetBlockSizeLong()Robolectric always uses a block size of 4096.protected intgetFreeBlocks()protected longgetFreeBlocksLong()protected longgetFreeBytes()protected longgetTotalBytes()static voidregisterStats(File path, int blockCount, int freeBlocks, int availableBlocks)Register stats for a path, which will be used when a matchingStatFsinstance is created.static voidregisterStats(String path, int blockCount, int freeBlocks, int availableBlocks)Register stats for a path, which will be used when a matchingStatFsinstance is created.static voidreset()protected voidrestat(String path)static voidunregisterStats(File path)Unregister stats for a path.static voidunregisterStats(String path)Unregister stats for a path.
-
-
-
Field Detail
-
BLOCK_SIZE
public static final int BLOCK_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
__constructor__
@Implementation protected void __constructor__(String path)
-
getBlockSize
@Implementation protected int getBlockSize()
-
getBlockCount
@Implementation protected int getBlockCount()
-
getFreeBlocks
@Implementation protected int getFreeBlocks()
-
getFreeBlocksLong
@Implementation(minSdk=18) protected long getFreeBlocksLong()
-
getFreeBytes
@Implementation(minSdk=18) protected long getFreeBytes()
-
getAvailableBytes
@Implementation(minSdk=18) protected long getAvailableBytes()
-
getTotalBytes
@Implementation(minSdk=18) protected long getTotalBytes()
-
getAvailableBlocks
@Implementation protected int getAvailableBlocks()
-
restat
@Implementation protected void restat(String path)
-
getBlockSizeLong
@Implementation(minSdk=18) protected long getBlockSizeLong()
Robolectric always uses a block size of 4096.
-
getBlockCountLong
@Implementation(minSdk=18) protected long getBlockCountLong()
-
getAvailableBlocksLong
@Implementation(minSdk=18) protected long getAvailableBlocksLong()
-
registerStats
public static void registerStats(File path, int blockCount, int freeBlocks, int availableBlocks)
Register stats for a path, which will be used when a matchingStatFsinstance is created.- Parameters:
path- path to the fileblockCount- number of blocksfreeBlocks- number of free blocksavailableBlocks- number of available blocks
-
registerStats
public static void registerStats(String path, int blockCount, int freeBlocks, int availableBlocks)
Register stats for a path, which will be used when a matchingStatFsinstance is created. AStatFsinstance matches if it extends path. If several registered paths match, we pick the longest one.- Parameters:
path- path to the fileblockCount- number of blocksfreeBlocks- number of free blocksavailableBlocks- number of available blocks
-
unregisterStats
public static void unregisterStats(File path)
Unregister stats for a path. If the path is not registered, it will be a no-op.- Parameters:
path- path to the file
-
unregisterStats
public static void unregisterStats(String path)
Unregister stats for a path. If the path is not registered, it will be a no-op.- Parameters:
path- path to the file
-
reset
@Resetter public static void reset()
-
-