Here you can find the source of getFreeSpaceOnPartition(File f)
Parameter | Description |
---|---|
f | the file |
public static long getFreeSpaceOnPartition(File f)
//package com.java2s; import java.io.*; public class Main { /**/*from w w w. j a v a2 s . com*/ * Returns the free space on the partion where the specified file is located * * @param f the file * @return the free space (byte) */ public static long getFreeSpaceOnPartition(File f) { // TODO sometimes f.getUsableSpace() returned 0 and we had to use // the filesystem root to determine free space. is it safe now to // directly use f.getUsableSpace() ? return f.getUsableSpace(); } }