package com.littlepanpc.downloader.util;

import android.os.Environment;
import android.os.StatFs;
/**
 * @class: StorageUtils
 * @Description: Storage Utility.
 * @author: Peter Pan
 * @email: happychinapc@gmail.com
 * @date: 2014-7-30 上午10:33:07
 * @since: 1.0.0
 *
 */
public class StorageUtils {
	public static final String DOWNLOAD_DIRECTORY = Environment
			.getExternalStorageDirectory() + "/downloads";
	public static final String DOWNLOAD_DIRECTORY_TEMP = Environment
			.getExternalStorageDirectory() + "/downloads/tmps";
	/**
	 * @Title: getAvailableStorage
	 * @Description: obtain available storage
	 * @return long
	 * @throws 
	 */
	public static long getAvailableStorage() {

		String storageDirectory = Environment.getExternalStorageDirectory()
				.toString();

		try {
			StatFs stat = new StatFs(storageDirectory);
			long avaliableSize = ((long) stat.getAvailableBlocks() * (long) stat
					.getBlockSize());
			return avaliableSize;
		} catch (RuntimeException ex) {
			return 0;
		}
	}

}

@@ -293,16 +293,81 @@
 Utils %7B%0A
+%09/**%0A%09 * @Field String DOWNLOAD_DIRECTORY: store directory.%0A%09 */%0A
 %09public 

Update StorageUtils.java