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