/** * 获取有效可用空间大小,单位byte * @param path * @return */ @SuppressLint("NewApi") private long getAvailableBytesByPath(String path) { long size = 0; mStatFs.restat(path); if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR2) { size = mStatFs.getAvailableBytes(); }else { long availableBlocks = mStatFs.getAvailableBlocks(); long blockSize = mStatFs.getBlockSize(); size = availableBlocks * blockSize; } return size; }
时间: 2024-10-18 18:51:43