Class Shell
java.lang.Object
org.apache.commons.vfs2.example.Shell
A simple command-line shell for performing file operations.
See Commons VFS Shell Examples in Apache Commons Wiki.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileObjectprivate final FileSystemManagerprivate final BufferedReader -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidDoes a 'cat' command.private voidDoes a 'cd' command.private voidDoes a 'cp' command.private static StringgetVersion(Class<?> cls) private voidgo()private voidhandleCommand(String[] cmd) Handles a command.private voidhelp()Does a 'help' command.private voidprivate voidprivate voidlistChildren(FileObject dir, boolean recursive, String prefix) Lists the children of a folder.private voidDoes an 'ls' command.static voidprivate String[]Returns the next command, split into tokens.private voidpwd()Does a 'pwd' command.private voidpwfs()Does a 'pwfs' command.private voidDoes an 'rm' command.private voidDoes a 'touch' command.
-
Field Details
-
mgr
-
cwd
-
reader
-
-
Constructor Details
-
Shell
- Throws:
IOException
-
-
Method Details
-
main
-
go
-
handleCommand
-
info
-
info
-
help
private void help()Does a 'help' command. -
rm
-
cp
-
cat
-
pwd
private void pwd()Does a 'pwd' command. -
pwfs
private void pwfs()Does a 'pwfs' command. -
cd
-
ls
Does an 'ls' command.- Throws:
FileSystemException
-
touch
-
listChildren
private void listChildren(FileObject dir, boolean recursive, String prefix) throws FileSystemException Lists the children of a folder.- Throws:
FileSystemException
-
nextCommand
Returns the next command, split into tokens.- Throws:
IOException
-
getVersion
-