List of usage examples for java.io File getUsableSpace
public long getUsableSpace()
From source file:id.wibisana.priadimulia.imagecaching.cache.ImageCache.java
@SuppressWarnings("deprecation") @TargetApi(9)// ww w.j a v a 2 s . c o m public static long getUsableSpace(File path) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.intelerad.android.portal.ImageCache.java
/** * Check how much usable space is available at a given path. * //from ww w .j ava2 s .c o m * @param path The path to check * @return The space available in bytes */ @TargetApi(Build.VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (UiUtils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:gr.unfold.android.tsibato.images.ImageCache.java
@TargetApi(9) public static long getUsableSpace(File path) { if (Utils.hasGingerbread()) { return path.getUsableSpace(); }//w w w .j a v a 2 s . c om final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.egoists.coco_nut.android.cache.ImageCache.java
/** * Check how much usable space is available at a given path. * //from ww w . j a v a2 s . c o m * @param path The path to check * @return The space available in bytes */ @TargetApi(Build.VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (EtcUtils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:org.benetech.secureapp.generator.BuildingApkController.java
private static void LogMemoryCheck(HttpSession session, String description, File baseBuildDir) { long totalSpace = getMegaBytes(baseBuildDir.getTotalSpace()); long freeSpace = getMegaBytes(baseBuildDir.getFreeSpace()); long usableSpace = getMegaBytes(baseBuildDir.getUsableSpace()); int processors = Runtime.getRuntime().availableProcessors(); long freeMemory = getMegaBytes(Runtime.getRuntime().freeMemory()); long maxMemory = Runtime.getRuntime().maxMemory(); String jvmMemory = (maxMemory == Long.MAX_VALUE ? "no limit" : String.valueOf(getMegaBytes(maxMemory))); long totalMemory = getMegaBytes(Runtime.getRuntime().totalMemory()); StringBuilder memoryUsed = new StringBuilder(); memoryUsed.append("MEMORY CHECK: "); memoryUsed.append(description);//from w w w . ja v a 2 s . c o m memoryUsed.append(": Processors = "); memoryUsed.append(processors); memoryUsed.append(", Total Memory = "); memoryUsed.append(totalMemory); memoryUsed.append(" MB, JVM Memory = "); memoryUsed.append(jvmMemory); memoryUsed.append(" MB, Free Memory = "); memoryUsed.append(freeMemory); memoryUsed.append(" MB -- Disk Total Space = "); memoryUsed.append(totalSpace); memoryUsed.append(" MB, Disk Usable Space = "); memoryUsed.append(usableSpace); memoryUsed.append(" MB, Disk Free Space = "); memoryUsed.append(freeSpace); memoryUsed.append(" MB."); SagLogger.logInfo(session, memoryUsed.toString()); }
From source file:com.intuit.qboecoui.feeds.util.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check// ww w . ja v a 2 s . c om * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (ElvesUtil.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.android.volley.plus.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check//from w w w. ja v a 2 s . co m * @return The space available in bytes */ // @TargetApi(9) public static long getUsableSpace(File path) { if (OsVersionUtils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:net.iaf.framework.imgload.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check/*from www .j a va2 s . c o m*/ * @return The space available in bytes */ @TargetApi(9) public static long getUsableSpace(File path) { if (SDKVersionUtil.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.example.image.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check//from w ww. j ava2 s . c o m * @return The space available in bytes */ @TargetApi(9) public static long getUsableSpace(File path) { if (VersionUtils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.thoughtworks.go.server.service.AgentRuntimeInfo.java
public static long usableSpace(String currentWorkingDir) { File file = new File(currentWorkingDir, "pipelines"); if (!file.exists()) { LOGGER.warn(/*from w ww . ja v a 2 s. c o m*/ "the [{}] should be created when agent starts up, but it seems missing at the moment. Cruise should be able to automatically create it later", file.getAbsolutePath()); } return file.getUsableSpace(); }