Esempio n. 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;
    }
Esempio n. 2
0
 @Override
 public Payload create() throws Exception {
   sftp = acquire(sftpConnection);
   return Payloads.newInputStreamPayload(
       new CloseFtpChannelOnCloseInputStream(
           sftp.getSFTPEngine().open(path).getInputStream(), sftp));
 }
Esempio n. 3
0
 @Override
 public void clear() {
   if (sftp != null)
     try {
       sftp.close();
     } catch (IOException e) {
       Throwables.propagate(e);
     }
 }
Esempio n. 4
0
 @Override
 public void close() throws IOException {
   super.close();
   if (sftp != null) sftp.close();
 }
Esempio n. 5
0
 @Override
 public void clear() throws IOException {
   if (sftp != null) sftp.close();
 }