Class ScpClientIO

java.lang.Object
com.sshtools.client.scp.ScpClientIO
Direct Known Subclasses:
ScpClient

public class ScpClientIO extends Object

Implements the IO of a Secure Copy (SCP) client. This has no dependencies upon Files.

Author:
Lee David Painter
  • Field Details

  • Constructor Details

    • ScpClientIO

      public ScpClientIO(SshClient ssh)

      Creates an SCP client.

      Parameters:
      ssh - a connected SshClient
  • Method Details

    • put

      public void put(InputStream in, long length, String localFile, String remoteFile) throws com.sshtools.common.ssh.SshException, com.sshtools.common.ssh.ChannelOpenException

      Uploads a java.io.InputStream to a remote server as a file. You must supply the correct number of bytes that will be written.

      Parameters:
      in - stream providing file
      length - number of bytes that will be written
      localFile - local file name
      remoteFile - remote file name
      Throws:
      IOException - on any error
      com.sshtools.common.ssh.SshException
      com.sshtools.common.ssh.ChannelOpenException
    • put

      public void put(InputStream in, long length, String localFile, String remoteFile, FileTransferProgress progress) throws com.sshtools.common.ssh.SshException, com.sshtools.common.ssh.ChannelOpenException

      Uploads a java.io.InputStream to a remote server as a file. You must supply the correct number of bytes that will be written.

      Parameters:
      in - stream providing file
      length - number of bytes that will be written
      localFile - local file name
      remoteFile - remote file name
      progress - a file transfer progress implementation
      Throws:
      IOException - on any error
      com.sshtools.common.ssh.SshException
      com.sshtools.common.ssh.ChannelOpenException
    • put

      public void put(InputStream in, long length, String localFile, String remoteFile, boolean remoteIsDir, FileTransferProgress progress) throws com.sshtools.common.ssh.SshException, com.sshtools.common.ssh.ChannelOpenException
      Parameters:
      in -
      length -
      localFile -
      remoteFile -
      remoteIsDir -
      progress -
      Throws:
      com.sshtools.common.ssh.SshException
      com.sshtools.common.ssh.ChannelOpenException
    • get

      public InputStream get(String remoteFile) throws com.sshtools.common.ssh.SshException, com.sshtools.common.ssh.ChannelOpenException

      Gets a remote file as a java.io.InputStream.

      Parameters:
      remoteFile - remote file name
      Returns:
      ScpInputStream
      Throws:
      IOException - on any error
      com.sshtools.common.ssh.SshException
      com.sshtools.common.ssh.ChannelOpenException
    • get

      public InputStream get(String remoteFile, FileTransferProgress progress) throws com.sshtools.common.ssh.SshException, com.sshtools.common.ssh.ChannelOpenException

      Gets a remote file as a java.io.InputStream.

      Parameters:
      remoteFile - remote file name
      progress - a file transfer progress implementation.
      Returns:
      ScpInputStream
      Throws:
      IOException - on any error
      com.sshtools.common.ssh.SshException
      com.sshtools.common.ssh.ChannelOpenException