We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OssFileEntity为业务所需封装的数据实体,可忽略
// 构造一个带指定 Region 对象的配置类 Configuration configuration = new Configuration(Region.region0()); Auth auth = Auth.create(qiniuOssProperty.getAccessKey(), qiniuOssProperty.getSecretKey()); BucketManager bucketManager = new BucketManager(auth, configuration); try { // 文件名前缀 String prefix = ""; // 指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。缺省值为空字符串 String delimiter = ""; // 列举空间文件列表(以100做示例) BucketManager.FileListIterator fileListIterator = bucketManager.createFileListIterator(qiniuOssProperty.getBucket(), prefix, 100, delimiter); List<OssFileEntity> ossFileEntityList = new ArrayList<>(); while (fileListIterator.hasNext()) { // 处理获取的file list结果 FileInfo[] items = fileListIterator.next(); for (FileInfo item : items) { ossFileEntityList.add(OssFileEntity.builder() .domain(qiniuOssProperty.getDomain()) .url(qiniuOssProperty.getDomain() + "/" + item.key) .suffix(FilenameUtils.getExtension(item.key)) .build()); } } return ossFileEntityList; } catch (Exception e) { throw new BaseException(e.getMessage()); }
无论传测试limit为100还是50都是返回超过预期设置的limit
The text was updated successfully, but these errors were encountered:
@ GabbyMrH
Limit 限制的是单次请求返回的数量,也即下面代码中 items 数组的长度:
FileInfo[] items = fileListIterator.next();
Sorry, something went wrong.
No branches or pull requests
代码如下
返回结果
The text was updated successfully, but these errors were encountered: