DF (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.fs, class: DF

Package org.apache.hadoop.fs

# Class DF

java.lang.Object
org.apache.hadoop.util.Shell
org.apache.hadoop.fs.DF

@LimitedPrivate({"HDFS","MapReduce"}) @Evolving public class DF extends Shell
Filesystem disk space usage statistics. Uses the unix 'df' program to get mount points, and java.io.File for space utilization. Tested on Linux, FreeBSD, Windows.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.hadoop.util.Shell

  `Shell.CommandExecutor, Shell.ExitCodeException, Shell.OSType, Shell.ShellCommandExecutor`

- ## Field Summary

  ### Fields inherited from class org.apache.hadoop.util.Shell

  `ENV_HADOOP_HOME, ENV_NAME_REGEX, FREEBSD, inheritParentEnv, isSetsidAvailable, LINK_COMMAND, LINUX, LOG, MAC, osType, OTHER, PPC_64, READ_LINK_COMMAND, SET_GROUP_COMMAND, SET_OWNER_COMMAND, SET_PERMISSION_COMMAND, SOLARIS, SYSPROP_HADOOP_HOME_DIR, timeOutInterval, TOKEN_SEPARATOR_REGEX, USER_NAME_COMMAND, WINDOWS, WINDOWS_MAX_SHELL_LENGHT, WINDOWS_MAX_SHELL_LENGTH, WindowsProcessLaunchLock, WINUTILS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DF(File path, long dfInterval)`
  `DF(File path, Configuration conf)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `getAvailable()`
  `long`
  `getCapacity()`
  `String`
  `getDirPath()`
  `protected String[]`
  `getExecString()`
  return an array containing the command name and its parameters.
  `String`
  `getFilesystem()`
  `String`
  `getMount()`
  `int`
  `getPercentUsed()`
  `long`
  `getUsed()`
  `static void`
  `main(String[] args)`
  `protected void`
  `parseExecResult(BufferedReader lines)`
  Parse the execution result.
  `protected void`
  `parseOutput()`
  `String`
  `toString()`

  ### Methods inherited from class org.apache.hadoop.util.Shell

  `appendScriptExtension, appendScriptExtension, bashQuote, checkIsBashSupported, checkWindowsCommandLineLength, destroyAllShellProcesses, execCommand, execCommand, execCommand, getAllShells, getCheckProcessIsAliveCommand, getEnvironment, getEnvironmentVariableRegex, getExitCode, getGetPermissionCommand, getGroupsCommand, getGroupsForUserCommand, getGroupsIDForUserCommand, getHadoopHome, getMemlockLimit, getProcess, getQualifiedBin, getQualifiedBinPath, getReadlinkCommand, getRunScriptCommand, getSetOwnerCommand, getSetPermissionCommand, getSetPermissionCommand, getSignalKillCommand, getSymlinkCommand, getUsersForNetgroupCommand, getWaitingThread, getWinUtilsFile, getWinUtilsPath, hasWinutilsPath, isJava7OrAbove, isJavaVersionAtLeast, isTimedOut, run, setEnvironment, setWorkingDirectory`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### DF

    public DF(File path, Configuration conf) throws IOException
    Throws:
      `IOException`

  - ### DF

    public DF(File path, long dfInterval) throws IOException
    Throws:
      `IOException`

- ## Method Details

  - ### getDirPath

    public String getDirPath()
    Returns:
      the canonical path to the volume we're checking.

  - ### getFilesystem

    public String getFilesystem() throws IOException
    Returns:
      a string indicating which filesystem volume we're checking.
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### getCapacity

    public long getCapacity()
    Returns:
      the capacity of the measured filesystem in bytes.

  - ### getUsed

    public long getUsed()
    Returns:
      the total used space on the filesystem in bytes.

  - ### getAvailable

    public long getAvailable()
    Returns:
      the usable space remaining on the filesystem in bytes.

  - ### getPercentUsed

    public int getPercentUsed()
    Returns:
      the amount of the volume full, as a percent.

  - ### getMount

    public String getMount() throws IOException
    Returns:
      the filesystem mount point for the indicated volume.
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getExecString

    protected String[] getExecString()
    Description copied from class: `Shell`
    return an array containing the command name and its parameters.
    Specified by:
      `getExecString` in class `Shell`
    Returns:
      exec string array.

  - ### parseExecResult

    protected void parseExecResult(BufferedReader lines) throws IOException
    Description copied from class: `Shell`
    Parse the execution result.
    Specified by:
      `parseExecResult` in class `Shell`
    Parameters:
      `lines` - lines.
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### parseOutput

    @VisibleForTesting protected void parseOutput() throws IOException
    Throws:
      `IOException`

  - ### main

    public static void main(String[] args) throws Exception
    Throws:
      `Exception`