Java IO Tutorial - Java File.getUsableSpace()








Syntax

File.getUsableSpace() has the following syntax.

public long getUsableSpace()

Example

In the following code shows how to use File.getUsableSpace() method.

//  w  w  w. ja  va2s.c o m

import java.io.File;

public class Main {
  public static void main(String[] args) throws Exception {

    // create new files
    File f = new File("c:/");


    System.out.print(f.getUsableSpace());

  }
}

The code above generates the following result.