首页 > 代码库 > android获取有效可用存储空间大小

android获取有效可用存储空间大小

	/**
	 * 获取有效可用空间大小,单位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;
	}

android获取有效可用存储空间大小