public RemoteFile open(String filename, Set<OpenMode> modes) throws IOException { return open(filename, modes, FileAttributes.EMPTY); }
public RemoteFile open(String filename, Set<OpenMode> mode, FileAttributes attrs) throws IOException { log.debug("Opening `{}`", filename); return engine.open(filename, mode, attrs); }
public RemoteFile open(String filename) throws IOException { return open(filename, EnumSet.of(OpenMode.READ)); }
RemoteFile.RemoteFileOutputStream rfos = null; try { rf = engine.open(adjusted, EnumSet.of(OpenMode.WRITE, OpenMode.CREAT, OpenMode.TRUNC)); fis = local.getInputStream(); rfos = rf.new RemoteFileOutputStream(0, 16);
private LocalDestFile downloadFile(final StreamCopier.Listener listener, final RemoteResourceInfo remote, final LocalDestFile local) throws IOException { final LocalDestFile adjusted = local.getTargetFile(remote.getName()); final RemoteFile rf = engine.open(remote.getPath()); try { final RemoteFile.ReadAheadRemoteFileInputStream rfis = rf.new ReadAheadRemoteFileInputStream(16); final OutputStream os = adjusted.getOutputStream(); try { new StreamCopier(rfis, os, engine.getLoggerFactory()) .bufSize(engine.getSubsystem().getLocalMaxPacketSize()) .keepFlushing(false) .listener(listener) .copy(); } finally { rfis.close(); os.close(); } } finally { rf.close(); } return adjusted; }
public RemoteFile open(String filename, Set<OpenMode> modes) throws IOException { return open(filename, modes, FileAttributes.EMPTY); }
public RemoteFile open(String filename, Set<OpenMode> modes) throws IOException { return open(filename, modes, FileAttributes.EMPTY); }
public RemoteFile open(String filename, Set<OpenMode> mode, FileAttributes attrs) throws IOException { log.debug("Opening `{}`", filename); return engine.open(filename, mode, attrs); }
public RemoteFile open(String filename, Set<OpenMode> mode, FileAttributes attrs) throws IOException { log.debug("Opening `{}`", filename); return engine.open(filename, mode, attrs); }
public RemoteFile open(String filename) throws IOException { return open(filename, EnumSet.of(OpenMode.READ)); }
public RemoteFile open(String filename) throws IOException { return open(filename, EnumSet.of(OpenMode.READ)); }
@Override public InputStream create() throws Exception { sftp = acquire(sftpConnection); return new CloseFtpChannelOnCloseInputStream( sftp.getSFTPEngine().open(path).getInputStream(), sftp); }
@Override public Payload create() throws Exception { sftp = acquire(sftpConnection); return Payloads.newInputStreamPayload(new CloseFtpChannelOnCloseInputStream(sftp.getSFTPEngine().open(path) .getInputStream(), sftp)); }
@Override public Payload create() throws Exception { sftp = acquire(sftpConnection); return Payloads.newInputStreamPayload(new CloseFtpChannelOnCloseInputStream(sftp.getSFTPEngine().open(path) .getInputStream(), sftp)); }
@Override public Payload create() throws Exception { sftp = acquire(sftpConnection); return Payloads.newInputStreamPayload(new CloseFtpChannelOnCloseInputStream(sftp.getSFTPEngine().open(path) .getInputStream(), sftp)); }
@Override public Payload create() throws Exception { sftp = acquire(sftpConnection); final RemoteFile remoteFile = sftp.getSFTPEngine().open(path); final InputStream in = remoteFile.new RemoteFileInputStream() { @Override public void close() throws IOException { try { super.close(); } finally { remoteFile.close(); } } }; return Payloads.newInputStreamPayload(new CloseFtpChannelOnCloseInputStream(in, sftp)); }
@Override public Payload create() throws Exception { sftp = acquire(sftpConnection); final RemoteFile remoteFile = sftp.getSFTPEngine().open(path); final InputStream in = remoteFile.new RemoteFileInputStream() { @Override public void close() throws IOException { try { super.close(); } finally { remoteFile.close(); } } }; return Payloads.newInputStreamPayload(new CloseFtpChannelOnCloseInputStream(in, sftp)); }
@Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { if(file.isFile()) { try { final FileAttributes attrs; if(Permission.EMPTY != status.getPermission()) { attrs = new FileAttributes.Builder().withPermissions(Integer.parseInt(status.getPermission().getMode(), 8)).build(); } else { attrs = FileAttributes.EMPTY; } final RemoteFile handle = session.sftp().open(file.getAbsolute(), EnumSet.of(OpenMode.CREAT, OpenMode.TRUNC, OpenMode.WRITE), attrs); handle.close(); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot create file {0}", e, file); } } return new Path(file.getParent(), file.getName(), file.getType(), new SFTPAttributesFinderFeature(session).find(file)); }
private LocalDestFile downloadFile(final StreamCopier.Listener listener, final RemoteResourceInfo remote, final LocalDestFile local) throws IOException { final LocalDestFile adjusted = local.getTargetFile(remote.getName()); final RemoteFile rf = engine.open(remote.getPath()); try { final RemoteFile.ReadAheadRemoteFileInputStream rfis = rf.new ReadAheadRemoteFileInputStream(16); final OutputStream os = adjusted.getOutputStream(); try { new StreamCopier(rfis, os, engine.getLoggerFactory()) .bufSize(engine.getSubsystem().getLocalMaxPacketSize()) .keepFlushing(false) .listener(listener) .copy(); } finally { rfis.close(); os.close(); } } finally { rf.close(); } return adjusted; }