Exemple #1
0
    @Override
    public Void create() throws Exception {
      sftp = acquire(sftpConnection);
      try {
        sftp.put(
            new InMemorySourceFile() {

              @Override
              public String getName() {
                return path;
              }

              @Override
              public long getLength() {
                return contents.getContentMetadata().getContentLength();
              }

              @Override
              public InputStream getInputStream() throws IOException {
                return checkNotNull(contents.getInput(), "inputstream for path %s", path);
              }
            },
            path);
      } finally {
        contents.release();
      }
      return null;
    }
Exemple #2
0
 @Override
 public Payload create() throws Exception {
   sftp = acquire(sftpConnection);
   return Payloads.newInputStreamPayload(
       new CloseFtpChannelOnCloseInputStream(
           sftp.getSFTPEngine().open(path).getInputStream(), sftp));
 }
Exemple #3
0
 @Override
 public void clear() {
   if (sftp != null)
     try {
       sftp.close();
     } catch (IOException e) {
       Throwables.propagate(e);
     }
 }
Exemple #4
0
 @Override
 public void close() throws IOException {
   super.close();
   if (sftp != null) sftp.close();
 }
Exemple #5
0
 @Override
 public void clear() throws IOException {
   if (sftp != null) sftp.close();
 }