List of usage examples for com.amazonaws.services.s3.model ListObjectsRequest ListObjectsRequest
public ListObjectsRequest(String bucketName, String prefix, String marker, String delimiter, Integer maxKeys)
From source file:org.onebusaway.admin.service.impl.S3FileServiceImpl.java
License:Apache License
@Override /**/* w ww. j a v a2s .c om*/ * list the files in the given directory. */ public List<String> list(String directory, int maxResults) { ListObjectsRequest request = new ListObjectsRequest(_bucketName, directory, null, null, maxResults); ObjectListing listing = _s3.listObjects(request); List<String> rows = new ArrayList<String>(); for (S3ObjectSummary summary : listing.getObjectSummaries()) { // if its a directory at the root level if (!summary.getKey().endsWith("/")) { rows.add(summary.getKey()); } } return rows; }