Class Shell


  • public final class Shell
    extends java.lang.Object
    A simple command-line shell for performing file operations.

    See Commons VFS Shell Examples in Apache Commons Wiki.

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Shell()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void cat​(java.lang.String[] cmd)
      Does a 'cat' command.
      private void cd​(java.lang.String[] cmd)
      Does a 'cd' command.
      private void cp​(java.lang.String[] cmd)
      Does a 'cp' command.
      private static java.lang.String getVersion​(java.lang.Class<?> cls)  
      private void go()  
      private void handleCommand​(java.lang.String[] cmd)
      Handles a command.
      private void help()
      Does a 'help' command.
      private void info​(java.lang.String scheme)  
      private void info​(java.lang.String[] cmd)  
      private void listChildren​(FileObject dir, boolean recursive, java.lang.String prefix)
      Lists the children of a folder.
      private void ls​(java.lang.String[] cmd)
      Does an 'ls' command.
      static void main​(java.lang.String[] args)  
      private java.lang.String[] nextCommand()
      Returns the next command, split into tokens.
      private void pwd()
      Does a 'pwd' command.
      private void pwfs()
      Does a 'pwfs' command.
      private void rm​(java.lang.String[] cmd)
      Does an 'rm' command.
      private void touch​(java.lang.String[] cmd)
      Does a 'touch' command.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Shell

        private Shell()
               throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
      • go

        private void go()
                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • handleCommand

        private void handleCommand​(java.lang.String[] cmd)
                            throws java.lang.Exception
        Handles a command.
        Throws:
        java.lang.Exception
      • info

        private void info​(java.lang.String[] cmd)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • info

        private void info​(java.lang.String scheme)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • help

        private void help()
        Does a 'help' command.
      • rm

        private void rm​(java.lang.String[] cmd)
                 throws java.lang.Exception
        Does an 'rm' command.
        Throws:
        java.lang.Exception
      • cp

        private void cp​(java.lang.String[] cmd)
                 throws java.lang.Exception
        Does a 'cp' command.
        Throws:
        java.lang.Exception
      • cat

        private void cat​(java.lang.String[] cmd)
                  throws java.lang.Exception
        Does a 'cat' command.
        Throws:
        java.lang.Exception
      • pwd

        private void pwd()
        Does a 'pwd' command.
      • pwfs

        private void pwfs()
        Does a 'pwfs' command.
      • cd

        private void cd​(java.lang.String[] cmd)
                 throws java.lang.Exception
        Does a 'cd' command. If the taget directory does not exist, a message is printed to System.err.
        Throws:
        java.lang.Exception
      • touch

        private void touch​(java.lang.String[] cmd)
                    throws java.lang.Exception
        Does a 'touch' command.
        Throws:
        java.lang.Exception
      • nextCommand

        private java.lang.String[] nextCommand()
                                        throws java.io.IOException
        Returns the next command, split into tokens.
        Throws:
        java.io.IOException
      • getVersion

        private static java.lang.String getVersion​(java.lang.Class<?> cls)