@Service
public class FtpService {
@Reference
private FtpConnector connector;
public void uploadFile(String localPath, String remotePath) throws IOException {
try (InputStream inputStream = new FileInputStream(localPath)) {
connector.upload(remotePath, inputStream);
}
}
public void downloadFile(String remotePath, String localPath) throws IOException {
try (OutputStream outputStream = new FileOutputStream(localPath)) {
connector.download(remotePath, outputStream);
}
}
}