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 int
BLOCK_SIZE
-
Constructor Summary
Constructors Constructor Description ShadowStatFs()
-
Method Summary
Modifier and Type Method 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 matchingStatFs
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 matchingStatFs
instance is created.static void
reset()
protected void
restat(String path)
static void
unregisterStats(File path)
Unregister stats for a path.static void
unregisterStats(String path)
Unregister stats for a path.
-
Field Details
-
BLOCK_SIZE
public static final int BLOCK_SIZE- See Also:
- Constant Field Values
-
-
Constructor Details
-
ShadowStatFs
public ShadowStatFs()
-
-
Method Details
-
__constructor__
-
getBlockSize
-
getBlockCount
-
getFreeBlocks
-
getFreeBlocksLong
-
getFreeBytes
-
getAvailableBytes
-
getTotalBytes
-
getAvailableBlocks
-
restat
-
getBlockSizeLong
Robolectric always uses a block size of 4096. -
getBlockCountLong
-
getAvailableBlocksLong
-
registerStats
Register stats for a path, which will be used when a matchingStatFs
instance is created.- Parameters:
path
- path to the fileblockCount
- number of blocksfreeBlocks
- number of free blocksavailableBlocks
- number of available blocks
-
registerStats
Register stats for a path, which will be used when a matchingStatFs
instance is created. AStatFs
instance 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
Unregister stats for a path. If the path is not registered, it will be a no-op.- Parameters:
path
- path to the file
-
unregisterStats
Unregister stats for a path. If the path is not registered, it will be a no-op.- Parameters:
path
- path to the file
-
reset
-