List of usage examples for android.os StatFs getBlockCount
@Deprecated public int getBlockCount()
From source file:Main.java
public static String getSDTotalSize(Context context) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return Formatter.formatFileSize(context, blockSize * totalBlocks); }
From source file:Main.java
public static String getRomTotalSize(Context context) { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return Formatter.formatFileSize(context, blockSize * totalBlocks); }
From source file:Main.java
public static String getTotalInternalMemorySize(Context context) { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return Formatter.formatFileSize(context, totalBlocks * blockSize); }
From source file:Main.java
public static String getMemTotalSize(Context ctx) { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return Formatter.formatFileSize(ctx, blockSize * totalBlocks); }
From source file:Main.java
@SuppressWarnings("deprecation") public static long getAvailableSD() { File path = Environment.getExternalStorageDirectory(); StatFs statFs = new StatFs(path.getPath()); long blockSize = statFs.getBlockSize(); long blockCount = statFs.getBlockCount(); long availableBlocks = statFs.getAvailableBlocks(); return availableBlocks * blockSize; }
From source file:Main.java
public static long getTotalInternalMemorySize() { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = (long) stat.getBlockSize(); long totalBlocks = (long) stat.getBlockCount(); return totalBlocks * blockSize; }
From source file:Main.java
public static long getAvailableROM() { File dataDirectory = Environment.getDataDirectory(); StatFs statFs = new StatFs(dataDirectory.getPath()); long blockSize = statFs.getBlockSize(); long blockCount = statFs.getBlockCount(); long availableBlocks = statFs.getAvailableBlocks(); return availableBlocks * blockSize; }
From source file:Main.java
public static long calculateUsedDiskSpaceInBytes(String path) { StatFs statFs = new StatFs(path); long blockSizeBytes = (long) statFs.getBlockSize(); return (blockSizeBytes * ((long) statFs.getBlockCount())) - (blockSizeBytes * ((long) statFs.getAvailableBlocks())); }
From source file:Main.java
/** * @return Total internal memory/*from w ww . j a va 2 s.co m*/ */ public static int getTotalInternalMemorySize() { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); int blockSize = stat.getBlockSize(); int totalBlocks = stat.getBlockCount(); return totalBlocks * blockSize; }
From source file:Main.java
public static long getTotalExternalMemorySize() { if (externalMemoryAvailable()) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return totalBlocks * blockSize; } else {/* ww w .j a v a2 s .com*/ return -1; } }