Example usage for android.os StatFs getBlockSize

List of usage examples for android.os StatFs getBlockSize

Introduction

In this page you can find the example usage for android.os StatFs getBlockSize.

Prototype

@Deprecated
public int getBlockSize() 

Source Link

Usage

From source file:com.channelsoft.common.bitmapUtil.ImageCache.java

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

    final StatFs stats = new StatFs(path.getPath());
    return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}

From source file:com.watabou.noosa.Game.java

@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public static long getAvailableInternalMemorySize() {
    File path = Environment.getDataDirectory();
    StatFs stat = new StatFs(path.getPath());
    long ret;//from w ww . j  ava 2s.  c o  m
    if (android.os.Build.VERSION.SDK_INT < 18) {
        long blockSize = stat.getBlockSize();
        long availableBlocks = stat.getAvailableBlocks();
        ret = availableBlocks * blockSize;
    } else {
        ret = stat.getAvailableBytes();
    }
    Util.storeEventInAcra("FreeInternalMemorySize", Long.toString(ret));
    return ret;
}

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

/**
 * Check how much usable space is available at a given path.
 * /*w  ww.ja v  a 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.frostwire.android.gui.transfers.TransferManager.java

static long getCurrentMountAvailableBytes() {
    StatFs stat = new StatFs(ConfigurationManager.instance().getStoragePath());
    return ((long) stat.getBlockSize() * (long) stat.getAvailableBlocks());
}

From source file:com.inter.trade.imageframe.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check/*from   w  w  w. j  av a2s  .  c  o  m*/
 * @return The space available in bytes
 */
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:com.wetrain.client.customviews.imagecache.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check/* w  w  w.  java 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:us.happ.bitmap.ImageCache.java

/**
 * Check how much usable space is available at a given path.
 *
 * @param path The path to check//from  ww  w .j  av  a2  s .c om
 * @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.androidsx.imagesearch.util.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 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 ww  .j a  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/*from   w  w  w.  j av  a  2 s . c o  m*/
 * @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();
}