Class DiskSpace

java.lang.Object
com.zybooks.dsaj.recursion.DiskSpace

public class DiskSpace extends Object
Supports the computation of the total disk space usage within a file system.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    Calculates the total disk usage (in bytes) of the portion of the file system rooted at the given path, while printing a summary akin to the standard 'du' Unix tool.
    static void
    main(String[] args)
    Computes disk usage of the path given as a command line argument.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DiskSpace

      public DiskSpace()
  • Method Details

    • diskUsage

      public static long diskUsage(File root)
      Calculates the total disk usage (in bytes) of the portion of the file system rooted at the given path, while printing a summary akin to the standard 'du' Unix tool.
      Parameters:
      root - designates a location in the file system
      Returns:
      total number of bytes used by the designated portion of the file system
    • main

      public static void main(String[] args)
      Computes disk usage of the path given as a command line argument. Sample usage: java DiskSpace C:\Users\Michael