org.apache.hadoop.fs
Class Command

java.lang.Object
  extended by org.apache.hadoop.fs.Command

public abstract class Command
extends Object

A base class for running a unix command like du or df


Constructor Summary
Command()
           
 
Method Summary
static String execCommand(String[] cmd)
          Static method to execute a command.
protected abstract  String[] getExecString()
          return an array comtaining the command name & its parameters
protected abstract  void parseExecResult(BufferedReader lines)
          Parse the execution result
protected  void run()
          Run a command
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command()
Method Detail

run

protected void run()
            throws IOException
Run a command

Throws:
IOException

getExecString

protected abstract String[] getExecString()
return an array comtaining the command name & its parameters


parseExecResult

protected abstract void parseExecResult(BufferedReader lines)
                                 throws IOException
Parse the execution result

Throws:
IOException

execCommand

public static String execCommand(String[] cmd)
                          throws IOException
Static method to execute a command. Covers most of the simple cases without requiring the user to implement Command interface.

Throws:
IOException


Copyright © 2006 The Apache Software Foundation