org.gridkit.lab.util.shell
Class Shell.SimpleShell

java.lang.Object
  extended by org.gridkit.lab.util.shell.Shell.SimpleShell
All Implemented Interfaces:
Serializable, Prompt
Enclosing class:
Shell

public static class Shell.SimpleShell
extends Object
implements Prompt, Serializable

See Also:
Serialized Form

Constructor Summary
Shell.SimpleShell()
           
 
Method Summary
 Prompt backup(String file)
           
 Prompt backup(String file, boolean remove)
           
 Shell.SimpleShell cd(String path)
           
 Shell.SimpleShell cd(String path, boolean mkdirs)
           
 Shell.SimpleShell env(String var, String value)
           
 Prompt exec(OutputStream stdOut, String... command)
           
 Shell.SimpleShell exec(String... command)
           
 Prompt exec(StringBuilder stdOut, String... command)
           
 Prompt execAt(String path, OutputStream stdOut, String... command)
           
 Shell.SimpleShell execAt(String path, String... command)
           
 Prompt execAt(String path, StringBuilder stdOut, String... command)
           
 Shell.ChildProcess execInteractive(OutputStream stdOut, String... command)
           
 Shell.ChildProcess execInteractive(String... command)
           
 Shell.ChildProcess execInteractive(StringBuilder stdOut, String... command)
           
 Shell.ChildProcess execInteractiveAt(String path, OutputStream stdOut, String... command)
           
 Shell.ChildProcess execInteractiveAt(String path, String... command)
           
 Shell.ChildProcess execInteractiveAt(String path, StringBuilder stdOut, String... command)
           
 boolean exists(String path)
           
 Prompt extract(String path)
           
 List<String> find(String pattern)
           
 List<String> find(String path, String pattern)
           
 List<String> list()
           
 List<String> list(String path)
           
static void main(String[] args)
           
 Shell.SimpleShell mkdirs(String path)
           
 Prompt out(OutputStream stdOut)
           
 Prompt out(StringBuilder stdOut)
           
 String pwd()
           
 Prompt rm(Collection<String> paths)
           
 Prompt rm(Collection<String> paths, boolean rf)
           
 Prompt rm(String path)
           
 Prompt rm(String path, boolean rf)
           
 Prompt waitForMatch(String path, String pattern)
           
 Prompt waitTimeout(long to, TimeUnit tu)
           
 Prompt wget(String url)
           
 Prompt writeTo(String path, byte[] data)
           
 Prompt writeTo(String path, byte[] data, boolean append)
           
 Prompt writeTo(String path, InputStream data)
           
 Prompt writeTo(String path, InputStream data, boolean append)
           
 Prompt writeTo(String path, String text)
           
 Prompt writeTo(String path, String text, boolean append)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shell.SimpleShell

public Shell.SimpleShell()
Method Detail

env

public Shell.SimpleShell env(String var,
                             String value)
Specified by:
env in interface Prompt

out

public Prompt out(OutputStream stdOut)
Specified by:
out in interface Prompt

out

public Prompt out(StringBuilder stdOut)
Specified by:
out in interface Prompt

waitTimeout

public Prompt waitTimeout(long to,
                          TimeUnit tu)
Specified by:
waitTimeout in interface Prompt

cd

public Shell.SimpleShell cd(String path)
                     throws IOException
Specified by:
cd in interface Prompt
Throws:
IOException

cd

public Shell.SimpleShell cd(String path,
                            boolean mkdirs)
                     throws IOException
Specified by:
cd in interface Prompt
Throws:
IOException

mkdirs

public Shell.SimpleShell mkdirs(String path)
                         throws IOException
Specified by:
mkdirs in interface Prompt
Throws:
IOException

exists

public boolean exists(String path)
               throws IOException
Specified by:
exists in interface Prompt
Throws:
IOException

pwd

public String pwd()
Specified by:
pwd in interface Prompt

list

public List<String> list()
                  throws IOException
Specified by:
list in interface Prompt
Throws:
IOException

list

public List<String> list(String path)
                  throws IOException
Specified by:
list in interface Prompt
Throws:
IOException

find

public List<String> find(String pattern)
                  throws IOException
Specified by:
find in interface Prompt
Throws:
IOException

find

public List<String> find(String path,
                         String pattern)
                  throws IOException
Specified by:
find in interface Prompt
Throws:
IOException

rm

public Prompt rm(Collection<String> paths)
          throws IOException
Specified by:
rm in interface Prompt
Throws:
IOException

rm

public Prompt rm(Collection<String> paths,
                 boolean rf)
          throws IOException
Specified by:
rm in interface Prompt
Throws:
IOException

waitForMatch

public Prompt waitForMatch(String path,
                           String pattern)
                    throws TimeoutException,
                           IOException
Specified by:
waitForMatch in interface Prompt
Throws:
TimeoutException
IOException

backup

public Prompt backup(String file)
              throws IOException
Specified by:
backup in interface Prompt
Throws:
IOException

backup

public Prompt backup(String file,
                     boolean remove)
              throws IOException
Specified by:
backup in interface Prompt
Throws:
IOException

rm

public Prompt rm(String path)
          throws IOException
Specified by:
rm in interface Prompt
Throws:
IOException

rm

public Prompt rm(String path,
                 boolean rf)
          throws IOException
Specified by:
rm in interface Prompt
Throws:
IOException

wget

public Prompt wget(String url)
            throws IOException
Specified by:
wget in interface Prompt
Throws:
IOException

extract

public Prompt extract(String path)
               throws IOException
Specified by:
extract in interface Prompt
Throws:
IOException

writeTo

public Prompt writeTo(String path,
                      String text)
               throws IOException
Specified by:
writeTo in interface Prompt
Throws:
IOException

writeTo

public Prompt writeTo(String path,
                      byte[] data)
               throws IOException
Specified by:
writeTo in interface Prompt
Throws:
IOException

writeTo

public Prompt writeTo(String path,
                      InputStream data)
               throws IOException
Specified by:
writeTo in interface Prompt
Throws:
IOException

writeTo

public Prompt writeTo(String path,
                      String text,
                      boolean append)
               throws IOException
Specified by:
writeTo in interface Prompt
Throws:
IOException

writeTo

public Prompt writeTo(String path,
                      byte[] data,
                      boolean append)
               throws IOException
Specified by:
writeTo in interface Prompt
Throws:
IOException

writeTo

public Prompt writeTo(String path,
                      InputStream data,
                      boolean append)
               throws IOException
Specified by:
writeTo in interface Prompt
Throws:
IOException

exec

public Shell.SimpleShell exec(String... command)
                       throws IOException,
                              InterruptedException
Specified by:
exec in interface Prompt
Throws:
IOException
InterruptedException

execAt

public Shell.SimpleShell execAt(String path,
                                String... command)
                         throws IOException,
                                InterruptedException
Specified by:
execAt in interface Prompt
Throws:
IOException
InterruptedException

exec

public Prompt exec(OutputStream stdOut,
                   String... command)
            throws IOException,
                   InterruptedException
Specified by:
exec in interface Prompt
Throws:
IOException
InterruptedException

exec

public Prompt exec(StringBuilder stdOut,
                   String... command)
            throws IOException,
                   InterruptedException
Specified by:
exec in interface Prompt
Throws:
IOException
InterruptedException

execAt

public Prompt execAt(String path,
                     OutputStream stdOut,
                     String... command)
              throws IOException,
                     InterruptedException
Specified by:
execAt in interface Prompt
Throws:
IOException
InterruptedException

execAt

public Prompt execAt(String path,
                     StringBuilder stdOut,
                     String... command)
              throws IOException,
                     InterruptedException
Specified by:
execAt in interface Prompt
Throws:
IOException
InterruptedException

execInteractive

public Shell.ChildProcess execInteractive(String... command)
                                   throws IOException,
                                          InterruptedException
Specified by:
execInteractive in interface Prompt
Throws:
IOException
InterruptedException

execInteractive

public Shell.ChildProcess execInteractive(OutputStream stdOut,
                                          String... command)
                                   throws IOException,
                                          InterruptedException
Specified by:
execInteractive in interface Prompt
Throws:
IOException
InterruptedException

execInteractive

public Shell.ChildProcess execInteractive(StringBuilder stdOut,
                                          String... command)
                                   throws IOException,
                                          InterruptedException
Specified by:
execInteractive in interface Prompt
Throws:
IOException
InterruptedException

execInteractiveAt

public Shell.ChildProcess execInteractiveAt(String path,
                                            String... command)
                                     throws IOException,
                                            InterruptedException
Specified by:
execInteractiveAt in interface Prompt
Throws:
IOException
InterruptedException

execInteractiveAt

public Shell.ChildProcess execInteractiveAt(String path,
                                            StringBuilder stdOut,
                                            String... command)
                                     throws IOException,
                                            InterruptedException
Specified by:
execInteractiveAt in interface Prompt
Throws:
IOException
InterruptedException

execInteractiveAt

public Shell.ChildProcess execInteractiveAt(String path,
                                            OutputStream stdOut,
                                            String... command)
                                     throws IOException,
                                            InterruptedException
Specified by:
execInteractiveAt in interface Prompt
Throws:
IOException
InterruptedException

main

public static void main(String[] args)
                 throws IOException,
                        InterruptedException
Throws:
IOException
InterruptedException


Copyright © 2017. All Rights Reserved.