final String remote) throws IOException { final String adjusted = prepareFile(local, remote); RemoteFile rf = null; InputStream fis = null;
private void upload(final TransferListener listener) throws IOException { if (source.isDirectory()) { makeDirIfNotExists(remote); // Ensure that the directory exists uploadDir(listener.directory(source.getName()), source, remote); setAttributes(source, remote); } else if (source.isFile() && isDirectory(remote)) { String adjustedRemote = engine.getPathHelper().adjustForParent(this.remote, source.getName()); uploadFile(listener.file(source.getName(), source.getLength()), source, adjustedRemote); setAttributes(source, adjustedRemote); } else if (source.isFile()) { uploadFile(listener.file(source.getName(), source.getLength()), source, remote); setAttributes(source, remote); } else { throw new IOException(source + " is not a file or directory"); } }
final String remote) throws IOException { final String adjusted = prepareFile(local, remote); RemoteFile rf = null; InputStream fis = null;
private String uploadFile(final StreamCopier.Listener listener, final LocalSourceFile local, final String remote) throws IOException { final String adjusted = prepareFile(local, remote); final RemoteFile rf = engine.open(adjusted, EnumSet.of(OpenMode.WRITE, OpenMode.CREAT, OpenMode.TRUNC)); try { final InputStream fis = local.getInputStream(); final RemoteFile.RemoteFileOutputStream rfos = rf.new RemoteFileOutputStream(0, 16); try { new StreamCopier(fis, rfos) .bufSize(engine.getSubsystem().getRemoteMaxPacketSize() - rf.getOutgoingPacketOverhead()) .keepFlushing(false) .listener(listener) .copy(); } finally { fis.close(); rfos.close(); } } finally { rf.close(); } return adjusted; }
private void upload(final TransferListener listener) throws IOException { if (source.isDirectory()) { makeDirIfNotExists(remote); // Ensure that the directory exists uploadDir(listener.directory(source.getName()), source, remote); setAttributes(source, remote); } else if (source.isFile() && isDirectory(remote)) { String adjustedRemote = engine.getPathHelper().adjustForParent(this.remote, source.getName()); uploadFile(listener.file(source.getName(), source.getLength()), source, adjustedRemote); setAttributes(source, adjustedRemote); } else if (source.isFile()) { uploadFile(listener.file(source.getName(), source.getLength()), source, remote); setAttributes(source, remote); } else { throw new IOException(source + " is not a file or directory"); } }
private void upload(final TransferListener listener, final LocalSourceFile local, final String remote) throws IOException { final String adjustedPath; if (local.isDirectory()) { adjustedPath = uploadDir(listener.directory(local.getName()), local, remote); } else if (local.isFile()) { adjustedPath = uploadFile(listener.file(local.getName(), local.getLength()), local, remote); } else throw new IOException(local + " is not a file or directory"); if (getPreserveAttributes()) engine.setAttributes(adjustedPath, getAttributes(local)); }
private void upload(final TransferListener listener, final LocalSourceFile local, final String remote) throws IOException { final String adjustedPath; if (local.isDirectory()) { adjustedPath = uploadDir(listener.directory(local.getName()), local, remote); } else if (local.isFile()) { adjustedPath = uploadFile(listener.file(local.getName(), local.getLength()), local, remote); } else { throw new IOException(local + " is not a file or directory"); } setAttributes(local, adjustedPath); }
@Override public void upload(LocalSourceFile localFile, String remotePath) throws IOException { new Uploader(localFile, remotePath).upload(getTransferListener()); }
private String uploadDir(final TransferListener listener, final LocalSourceFile local, final String remote) throws IOException { final String adjusted = prepareDir(local, remote); for (LocalSourceFile f : local.getChildren(getUploadFilter())) upload(listener, f, adjusted); return adjusted; }
@Override public void upload(LocalSourceFile localFile, String remotePath) throws IOException { new Uploader().upload(getTransferListener(), localFile, remotePath); }
private void setAttributes(LocalSourceFile local, String remotePath) throws IOException { if (getPreserveAttributes()) { engine.setAttributes(remotePath, getAttributes(local)); } }
private String uploadDir(final TransferListener listener, final LocalSourceFile local, final String remote) throws IOException { makeDirIfNotExists(remote); for (LocalSourceFile f : local.getChildren(getUploadFilter())) upload(listener, f, engine.getPathHelper().adjustForParent(remote, f.getName())); return remote; }
private void upload(final TransferListener listener, final LocalSourceFile local, final String remote) throws IOException { final String adjustedPath; if (local.isDirectory()) { adjustedPath = uploadDir(listener.directory(local.getName()), local, remote); } else if (local.isFile()) { adjustedPath = uploadFile(listener.file(local.getName(), local.getLength()), local, remote); } else { throw new IOException(local + " is not a file or directory"); } setAttributes(local, adjustedPath); }
@Override public void upload(LocalSourceFile localFile, String remotePath) throws IOException { new Uploader(localFile, remotePath).upload(getTransferListener()); }
private void setAttributes(LocalSourceFile local, String remotePath) throws IOException { if (getPreserveAttributes()) { engine.setAttributes(remotePath, getAttributes(local)); } }
private String uploadDir(final TransferListener listener, final LocalSourceFile local, final String remote) throws IOException { makeDirIfNotExists(remote); for (LocalSourceFile f : local.getChildren(getUploadFilter())) upload(listener, f, engine.getPathHelper().adjustForParent(remote, f.getName())); return remote; }