Package org.apache.hadoop.fs.shell
Class Truncate
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.shell.Command
org.apache.hadoop.fs.shell.FsCommand
org.apache.hadoop.fs.shell.Truncate
- All Implemented Interfaces:
Configurable
Truncates a file to a new size
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected longstatic final Stringprotected booleanFields inherited from class org.apache.hadoop.fs.shell.Command
args, COMMAND_DESCRIPTION_FIELD, COMMAND_NAME_FIELD, COMMAND_USAGE_FIELD, err, exceptions, exitCode, name, numErrors, out, recursive -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprocessArguments(LinkedList<PathData> args) Processes the command's list of expanded arguments.protected voidprocessOptions(LinkedList<String> args) Must be implemented by commands to process the command line flags and check the bounds of the remaining arguments.protected voidprocessPath(PathData item) Hook for commands to implement an operation to be applied on each path for the command.static voidregisterCommands(CommandFactory factory) Methods inherited from class org.apache.hadoop.fs.shell.FsCommand
getCommandName, processRawArguments, run, runAllMethods inherited from class org.apache.hadoop.fs.shell.Command
displayError, displayError, displayWarning, exitCodeForError, expandArgument, expandArguments, getCommandFactory, getDepth, getDescription, getListingGroupSize, getName, getReplacementCommand, getUsage, isDeprecated, isPathRecursable, isRecursive, isSorted, postProcessPath, processArgument, processNonexistentPath, processPathArgument, processPaths, processPaths, recursePath, run, run, setCommandFactory, setName, setRecursiveMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
-
Field Details
-
NAME
- See Also:
-
USAGE
- See Also:
-
DESCRIPTION
- See Also:
-
newLength
protected long newLength -
waitList
-
waitOpt
protected boolean waitOpt
-
-
Constructor Details
-
Truncate
public Truncate()
-
-
Method Details
-
registerCommands
-
processOptions
Description copied from class:CommandMust be implemented by commands to process the command line flags and check the bounds of the remaining arguments. If an IllegalArgumentException is thrown, the FsShell object will print the short usage of the command.- Overrides:
processOptionsin classCommand- Parameters:
args- the command line arguments- Throws:
IOException- raised on errors performing I/O.
-
processArguments
Description copied from class:CommandProcesses the command's list of expanded arguments.Command.processArgument(PathData)will be invoked with each item in the list. The loop catches IOExceptions, increments the error count, and displays the exception.- Overrides:
processArgumentsin classCommand- Parameters:
args- a list ofPathDatato process- Throws:
IOException- if anything goes wrong...
-
processPath
Description copied from class:CommandHook for commands to implement an operation to be applied on each path for the command. Note implementation of this method is optional if earlier methods in the chain handle the operation.- Overrides:
processPathin classCommand- Parameters:
item- aPathDataobject- Throws:
IOException- if anything else goes wrong in the user-implementation
-