所以我得到了Florian Müller 的帮助。
对于任何有兴趣的人,从原生 android 应用程序中的 SAP 移动文档服务器下载文件夹作为 .zip 存档的最终代码如下所示:
public void downloadAsZip(Session session, Folder folder, File destination){
ContentStream zipStream = session.getContentStream(folder, "sap:zipRendition", null, null);
InputStream inputStream = zipStream.getStream();
try {
File file = new File(destination, folder.getName()+".zip");
FileOutputStream fileOutputStream = new FileOutputStream(file);
byte[] buffer = new byte[1024];
int bufferLength = 0;
while ((bufferLength = inputStream.read(buffer)) > 0) {
fileOutputStream.write(buffer, 0, bufferLength);
}
fileOutputStream.close();
inputStream.close();
}
catch(IOException e){
Log.e(TAG, "An error occurred: "+e.getMessage());
}
}