rename internal upload method to doUpload

This commit is contained in:
Jörg Prante 2024-05-15 17:27:31 +02:00
parent f2d00b7f83
commit 0f0f6bfa09

View file

@ -207,7 +207,7 @@ public class SFTPFileService implements FileService {
Set<PosixFilePermission> filePermissions, Set<PosixFilePermission> filePermissions,
CopyOption... copyOptions) throws IOException { CopyOption... copyOptions) throws IOException {
performWithContext(ctx -> { performWithContext(ctx -> {
upload(ctx, Files.newByteChannel(source), ctx.fileSystem.getPath(target), doUpload(ctx, Files.newByteChannel(source), ctx.fileSystem.getPath(target),
dirPermissions, filePermissions, copyOptions); dirPermissions, filePermissions, copyOptions);
return null; return null;
}); });
@ -227,7 +227,7 @@ public class SFTPFileService implements FileService {
Set<PosixFilePermission> filePermissions, Set<PosixFilePermission> filePermissions,
CopyOption... copyOptions) throws IOException { CopyOption... copyOptions) throws IOException {
performWithContext(ctx -> { performWithContext(ctx -> {
upload(ctx, Files.newByteChannel(source), target, dirPermissions, filePermissions, copyOptions); doUpload(ctx, Files.newByteChannel(source), target, dirPermissions, filePermissions, copyOptions);
return null; return null;
}); });
} }
@ -337,7 +337,7 @@ public class SFTPFileService implements FileService {
Set<PosixFilePermission> filePermissions, Set<PosixFilePermission> filePermissions,
CopyOption... copyOptions) throws IOException { CopyOption... copyOptions) throws IOException {
performWithContext(ctx -> { performWithContext(ctx -> {
upload(ctx, Channels.newChannel(source), target, doUpload(ctx, Channels.newChannel(source), target,
dirPermissions, filePermissions, copyOptions); dirPermissions, filePermissions, copyOptions);
return null; return null;
}); });
@ -350,18 +350,18 @@ public class SFTPFileService implements FileService {
Set<PosixFilePermission> filePermissions, Set<PosixFilePermission> filePermissions,
CopyOption... copyOptions) throws IOException { CopyOption... copyOptions) throws IOException {
performWithContext(ctx -> { performWithContext(ctx -> {
upload(ctx, Channels.newChannel(source), ctx.fileSystem.getPath(target), doUpload(ctx, Channels.newChannel(source), ctx.fileSystem.getPath(target),
dirPermissions, filePermissions, copyOptions); dirPermissions, filePermissions, copyOptions);
return null; return null;
}); });
} }
private void upload(SFTPContext ctx, private void doUpload(SFTPContext ctx,
ReadableByteChannel source, ReadableByteChannel source,
Path target, Path target,
Set<PosixFilePermission> dirPerms, Set<PosixFilePermission> dirPerms,
Set<PosixFilePermission> filePerms, Set<PosixFilePermission> filePerms,
CopyOption... copyOptions) throws IOException { CopyOption... copyOptions) throws IOException {
prepareForWrite(target, dirPerms, filePerms); prepareForWrite(target, dirPerms, filePerms);
transfer(source, ctx.provider.newByteChannel(target, prepareWriteOptions(copyOptions))); transfer(source, ctx.provider.newByteChannel(target, prepareWriteOptions(copyOptions)));
} }