php直播源码,Android 获取空间大小

php直播源码,Android 获取空间大小相关的代码

public static void readSDCard() {
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
        File sdcardDir = Environment.getExternalStorageDirectory();
        StatFs statFs = new StatFs(sdcardDir.getPath());
        long blockSize = statFs.getBlockSize();
        long blockCount = statFs.getBlockCount();
        long availCount = statFs.getAvailableBlocks();
        Log.d("gggg", "block大小:" + blockSize + ",block数目:" + blockCount + ",总大小:" + blockSize * blockCount / 1024 + "KB");
        Log.d("gggg", "可用的block数目::" + availCount + ",剩余空间:" + availCount * blockSize / 1024 + "KB");
    }
}

/**
 * 获取总空间大小
 *
 * @return 单位KB
 */
public static long totalSize() {
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
        File sdcardDir = Environment.getExternalStorageDirectory();
        StatFs statFs = new StatFs(sdcardDir.getPath());
        long blockSize = statFs.getBlockSize();
        long blockCount = statFs.getBlockCount();
        return blockSize * blockCount / 1024;
    }
    return 0;
}

/**
 * 剩余空间大小
 *
 * @return 单位KB
 */
public static long availSize() {
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
        File sdcardDir = Environment.getExternalStorageDirectory();
        StatFs statFs = new StatFs(sdcardDir.getPath());
        long blockSize = statFs.getBlockSize();
        long availCount = statFs.getAvailableBlocks();
        return availCount * blockSize / 1024;
    }
    return 0;

}
 

以上就是php直播源码,Android 获取空间大小相关的代码, 更多内容欢迎关注之后的文章

上一篇:【超全面】【持续更新中】Windows-美化指南


下一篇:Apollo 整合 Spring Boot 原理分析