Example usage for java.io File getUsableSpace

List of usage examples for java.io File getUsableSpace

Introduction

In this page you can find the example usage for java.io File getUsableSpace.

Prototype

public long getUsableSpace() 

Source Link

Document

Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname.

Usage

From source file:com.jasper.image.imagemanager.imagehelper.imageEngine.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check/*w w  w  .  j  a va2 s.  c  om*/
 * @return The space available in bytes
 */

public static long getUsableSpace(File path) {
    return path.getUsableSpace();

}

From source file:ar.com.lapotoca.resiliencia.gallery.util.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check/*from  w  ww  .jav  a  2  s  .c  o  m*/
 * @return The space available in bytes
 */
@TargetApi(VERSION_CODES.GINGERBREAD)
public static long getUsableSpace(File path) {
    return path.getUsableSpace();
}

From source file:us.happ.bitmap.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check//from  w  w  w. j  a  v  a 2s .  c o  m
 * @return The space available in bytes
 */
@TargetApi(9)
public static long getUsableSpace(File path) {
    if (Happ.hasGingerbread) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:com.kaplandroid.colorbook.utils.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 * //  w  w  w.  j  a va 2 s  .  c o  m
 * @param path
 *            The path to check
 * @return The space available in bytes
 */
@TargetApi(9)
public static long getUsableSpace(File path) {
    if (Utils.hasGingerbread() || Utils.hasHoneycomb() || Utils.hasJellyBean()) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:com.wetrain.client.customviews.imagecache.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check//from   w w  w.  j  a va  2 s  .c o m
 * @return The space available in bytes
 */
@TargetApi(9)
public static long getUsableSpace(File path) {
    if (Utills.hasGingerbread()) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:com.androidsx.imagesearch.util.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check/* ww  w.ja va 2s  .c  o m*/
 * @return The space available in bytes
 */
@TargetApi(9)
public static long getUsableSpace(File path) {
    if (Platform.hasGingerbread()) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:com.zz.lib.bitmapfun.util.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check//  w  w  w  . ja  v a2 s .  c  om
 * @return The space available in bytes
 */
@TargetApi(9)
public static long getUsableSpace(File path) {
    if (Utils.hasGingerbread()) {
        return path.getUsableSpace();
    }
    if (!path.exists())
        return 0;
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:com.gelakinetic.mtgfam.helpers.lruCache.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check/*w w  w  . ja  va 2 s  . c om*/
 * @return The space available in bytes
 */
@TargetApi(VERSION_CODES.GINGERBREAD)
private static long getUsableSpace(File path) {
    if (Utils.hasGingerbread()) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:net.wespot.pim.utils.images.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check// w ww.j a v a2  s  . c  o  m
 * @return The space available in bytes
 */
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static long getUsableSpace(File path) {
    if (Utils.hasGingerbread()) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:gov.nasa.ensemble.common.io.FileUtilities.java

public static String getUsableSpaceString(File anyFileInSystem) {
    long totalSpace = anyFileInSystem.getTotalSpace();
    if (totalSpace == 0)
        return "Disk space unknown.";
    long usableSpace = anyFileInSystem.getUsableSpace();
    return bytesString(usableSpace) + " out of " + bytesString(totalSpace) + " available.";
}