Class ShadowStatFs

    • Constructor Detail

      • ShadowStatFs

        public ShadowStatFs()
    • Method Detail

      • getBlockSizeLong

        @Implementation(minSdk=18)
        protected long getBlockSizeLong()
        Robolectric always uses a block size of 4096.
      • registerStats

        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.
        Parameters:
        path - path to the file
        blockCount - number of blocks
        freeBlocks - number of free blocks
        availableBlocks - 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 matching StatFs instance is created. A StatFs instance matches if it extends path. If several registered paths match, we pick the longest one.
        Parameters:
        path - path to the file
        blockCount - number of blocks
        freeBlocks - number of free blocks
        availableBlocks - 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()