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