Example usage for android.os StatFs getBlockCount

List of usage examples for android.os StatFs getBlockCount

Introduction

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

Prototype

@Deprecated
public int getBlockCount() 

Source Link

Usage

From source file:Main.java

public static long getUsableSpace(File path) {
    final StatFs stats = new StatFs(path.getPath());
    return stats.getBlockCount() * stats.getAvailableBlocks();
}

From source file:Main.java

static public long getTotalInternalMemorySize(StatFs stat) {
    long blockSize = stat.getBlockSize();
    long totalBlocks = stat.getBlockCount();
    return totalBlocks * blockSize;
}

From source file:Main.java

private static long getTotalSize(String path) {
    StatFs fileStats = new StatFs(path);
    fileStats.restat(path);//from w w  w .  ja v  a  2  s .  com
    return (long) fileStats.getBlockCount() * fileStats.getBlockSize();
}

From source file:Main.java

/**
 * @return The total storage in MegaBytes
 *//*from   w  w  w .  jav a  2 s.c o  m*/
public static Long getTotalInternalDataSize() {
    StatFs stat = new StatFs(Environment.getDataDirectory().getPath());
    long size = stat.getBlockCount() * stat.getBlockSize();
    return size / BYTES_TO_MB;
}

From source file:Main.java

public static long getSDAllSize() {
    StatFs sf = new StatFs(Environment.getExternalStorageDirectory().getPath());
    return ((((long) sf.getBlockCount()) * ((long) sf.getBlockSize())) / 1024) / 1024;
}

From source file:Main.java

private static boolean checkMicroSDCard(String fileSystemName) {
    StatFs statFs = new StatFs(fileSystemName);

    long totalSize = (long) statFs.getBlockSize() * statFs.getBlockCount();

    if (totalSize < 1024 * 1024 * 1024 * 1024) {
        return false;
    }//from   w  w w  . ja va 2  s.  c  o m

    return true;
}

From source file:Main.java

public static long getTotalInternalMemorySize() {
    File path = Environment.getDataDirectory();
    StatFs stat = new StatFs(path.getPath());
    long blockSize = stat.getBlockSize();
    long totalBlocks = stat.getBlockCount();
    return totalBlocks * blockSize;
}

From source file:Main.java

public static long getAvailableInternalRomSize() {
    File path = Environment.getDataDirectory();
    StatFs stat = new StatFs(path.getPath());
    long blockSize = stat.getBlockSize();
    long totalBlocks = stat.getBlockCount();
    long availBlocks = stat.getAvailableBlocks();
    return availBlocks * blockSize;
}

From source file:Main.java

public static long getTotalInternalMemorySize() {
    File path = Environment.getDataDirectory();
    StatFs stat = new StatFs(path.getPath());
    long blockSize = stat.getBlockSize();
    long totalBlocks = stat.getBlockCount();
    return totalBlocks * blockSize / 1024 / 1024;
}

From source file:Main.java

@SuppressWarnings("deprecation")
public static long getTotalInternalMemorySize() {
    File path = Environment.getDataDirectory();
    StatFs stat = new StatFs(path.getPath());
    long blockSize = stat.getBlockSize();
    long totalBlocks = stat.getBlockCount();
    return totalBlocks * blockSize;
}