org.apache.sshd.server.command
Class ScpCommand

java.lang.Object
  extended by org.apache.sshd.server.command.ScpCommand
All Implemented Interfaces:
java.lang.Runnable, Command

public class ScpCommand
extends java.lang.Object
implements Command, java.lang.Runnable

This commands provide SCP support on both server and client side. Permissions and preservation of access / modification times on files are not supported.

Author:
Apache MINA SSHD Project

Field Summary
protected  ExitCallback callback
           
protected  java.io.OutputStream err
           
protected  java.io.IOException error
           
protected static int ERROR
           
protected  java.io.InputStream in
           
protected static org.slf4j.Logger log
           
protected  java.lang.String name
           
protected static int OK
           
protected  boolean optD
           
protected  boolean optF
           
protected  boolean optP
           
protected  boolean optR
           
protected  boolean optT
           
protected  boolean optV
           
protected  java.io.OutputStream out
           
protected  java.lang.String root
           
protected static int WARNING
           
 
Constructor Summary
ScpCommand(java.lang.String[] args)
           
 
Method Summary
protected  void ack()
           
 void destroy()
          Destroy the shell.
protected  int readAck(boolean canEof)
           
protected  void readDir(java.io.File path)
           
protected  void readFile(java.io.File path)
           
protected  java.lang.String readLine()
           
 void run()
           
 void setErrorStream(java.io.OutputStream err)
          Set the error stream that can be used by the shell to write its errors.
 void setExitCallback(ExitCallback callback)
          Set the callback that the shell has to call when it is closed.
 void setInputStream(java.io.InputStream in)
          Set the input stream that can be used by the shell to read input.
 void setOutputStream(java.io.OutputStream out)
          Set the output stream that can be used by the shell to write its output.
 void start(Environment env)
          Starts the shell.
protected  void writeDir(java.lang.String header, java.io.File path)
           
protected  void writeFile(java.lang.String header, java.io.File path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.slf4j.Logger log

OK

protected static final int OK
See Also:
Constant Field Values

WARNING

protected static final int WARNING
See Also:
Constant Field Values

ERROR

protected static final int ERROR
See Also:
Constant Field Values

name

protected java.lang.String name

optR

protected boolean optR

optT

protected boolean optT

optF

protected boolean optF

optV

protected boolean optV

optD

protected boolean optD

optP

protected boolean optP

root

protected java.lang.String root

in

protected java.io.InputStream in

out

protected java.io.OutputStream out

err

protected java.io.OutputStream err

callback

protected ExitCallback callback

error

protected java.io.IOException error
Constructor Detail

ScpCommand

public ScpCommand(java.lang.String[] args)
Method Detail

setInputStream

public void setInputStream(java.io.InputStream in)
Description copied from interface: Command
Set the input stream that can be used by the shell to read input.

Specified by:
setInputStream in interface Command

setOutputStream

public void setOutputStream(java.io.OutputStream out)
Description copied from interface: Command
Set the output stream that can be used by the shell to write its output.

Specified by:
setOutputStream in interface Command

setErrorStream

public void setErrorStream(java.io.OutputStream err)
Description copied from interface: Command
Set the error stream that can be used by the shell to write its errors.

Specified by:
setErrorStream in interface Command

setExitCallback

public void setExitCallback(ExitCallback callback)
Description copied from interface: Command
Set the callback that the shell has to call when it is closed.

Specified by:
setExitCallback in interface Command

start

public void start(Environment env)
           throws java.io.IOException
Description copied from interface: Command
Starts the shell. All streams must have been set before calling this method.

Specified by:
start in interface Command
Throws:
java.io.IOException

destroy

public void destroy()
Description copied from interface: Command
Destroy the shell. This method can be called by the SSH server to destroy the shell because the client has disconnected somehow.

Specified by:
destroy in interface Command

run

public void run()
Specified by:
run in interface java.lang.Runnable

writeDir

protected void writeDir(java.lang.String header,
                        java.io.File path)
                 throws java.io.IOException
Throws:
java.io.IOException

writeFile

protected void writeFile(java.lang.String header,
                         java.io.File path)
                  throws java.io.IOException
Throws:
java.io.IOException

readLine

protected java.lang.String readLine()
                             throws java.io.IOException
Throws:
java.io.IOException

readFile

protected void readFile(java.io.File path)
                 throws java.io.IOException
Throws:
java.io.IOException

readDir

protected void readDir(java.io.File path)
                throws java.io.IOException
Throws:
java.io.IOException

ack

protected void ack()
            throws java.io.IOException
Throws:
java.io.IOException

readAck

protected int readAck(boolean canEof)
               throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.