Ejemplo n.º 1
0
 public SftpChannelInputStream createSftpInputStream(String remotePath)
     throws SftpException, JSchException {
   logger.debug("createSftpInputStream() to:{}", this);
   SftpChannel newChannel = this.createSftpChannel();
   newChannel.connect();
   InputStream inps = newChannel.get(remotePath);
   return new SftpChannelInputStream(newChannel, inps);
 }
Ejemplo n.º 2
0
  public SftpChannelOutputStream createSftpOutputStream(String remotePath, boolean append)
      throws SftpException, JSchException {
    logger.debug("createSftpOutputStream() to:{}", this);
    SftpChannel outputChannel = createSftpChannel();
    outputChannel.connect();

    int mode = ChannelSftp.APPEND;
    if (append == false) {
      mode = ChannelSftp.OVERWRITE;
    }

    OutputStream outps = outputChannel.put(remotePath, mode);
    return new SftpChannelOutputStream(outps, outputChannel);
  }