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.xiaodong.dream.catcher.demo.image.ImageCache.java

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

}

From source file:com.haipeng.libraryforandroid.cacheormemory.imageload.ImageCache.java

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

From source file:com.tack.android.image.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.co  m*/
 * @return The space available in bytes
 */
@TargetApi(9)
public static long getUsableSpace(File path) {
    if (ConfigUtil.hasV09()) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:com.andreaszeiser.bob.ImageCache.java

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

From source file:com.wowcow.chat10.imagecache.ImageCache.java

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

From source file:com.fivehundredpxdemo.android.storage.ImageCache.java

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

From source file:com.fireplace.market.fads.util.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 * /*from   w  w w . java  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 (Fireplace.IS_GINGERBREAD) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:de.s2hmobile.bitmaps.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 * /*from  w  w  w.ja  v a2s .co m*/
 * @param path
 *            The path to check
 * @return The space available in bytes
 */
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private static long getUsableSpace(final File path) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        return path.getUsableSpace();
    }

    return getUsableSpaceFroyo(path);
}

From source file:com.test.displaybitmaps.imagemanager.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 * //from www.  j a va2s. com
 * @param path
 *            The path to check
 * @return The space available in bytes
 */
@TargetApi(VERSION_CODES.GINGERBREAD)
public static long getUsableSpace(File path) {
    if (Build.VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
        return path.getUsableSpace();
    }
    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:com.amachikhin.vkmachikhin.utils.image_cache.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check/*w w  w  . j a  va  2  s  .  co m*/
 * @return The space available in bytes
 */
public static long getUsableSpace(File path) {
    return path.getUsableSpace();
}