|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--Command
|
+--Head
The Head class (a subclass of the abstract base class Command)
implements the familiar unix command head, which outputs the
first number of lines of each file.
This class implements the abstract methods execute and
getDescription inherited from the abstract base class
Command.
| Field Summary | |
protected java.util.Vector |
fileList
A vector containing string arguments to head - i.e. filenames. |
protected int |
numLinesToRead
An int value containing the number of lines to read from file. |
protected java.util.Vector |
numList
A vector containing numerical arguments to head. |
| Constructor Summary | |
Head()
|
|
| Method Summary | |
java.lang.String |
execute(java.lang.String args)
Executes the head command and returns the result in the form of a String object. |
protected java.lang.String |
fileToString(java.lang.String filename)
A helper function that converts the given file to a String object containing the number of lines
specified by numLinesToRead. |
java.lang.String |
getDescription()
Returns a description of the command. |
protected void |
processArgs(java.lang.String argLine)
A helper function that parses the arguments of this command into appropriate containers. |
| Methods inherited from class Command |
ExpandArgs |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Vector numList
protected java.util.Vector fileList
protected int numLinesToRead
| Constructor Detail |
public Head()
| Method Detail |
public java.lang.String execute(java.lang.String args)
String object.
execute in class Commandargs - arguments for this command.
protected java.lang.String fileToString(java.lang.String filename)
String object containing the number of lines
specified by numLinesToRead.
filename - name of file to be converted to a string.
protected void processArgs(java.lang.String argLine)
argLine - arguments to be parsed.public java.lang.String getDescription()
Command
getDescription in class Command
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||