コード例 #1
0
 public ImmutableMap<String, BlobMetaData> listBlobs() throws IOException {
   FileStatus[] files = blobStore.fileSystem().listStatus(path);
   if (files == null || files.length == 0) {
     return ImmutableMap.of();
   }
   ImmutableMap.Builder<String, BlobMetaData> builder = ImmutableMap.builder();
   for (FileStatus file : files) {
     builder.put(
         file.getPath().getName(), new PlainBlobMetaData(file.getPath().getName(), file.getLen()));
   }
   return builder.build();
 }
コード例 #2
0
 @Override
 public ImmutableMap<String, BlobMetaData> listBlobsByPrefix(final @Nullable String blobNamePrefix)
     throws IOException {
   FileStatus[] files =
       blobStore
           .fileSystem()
           .listStatus(
               path,
               new PathFilter() {
                 @Override
                 public boolean accept(Path path) {
                   return path.getName().startsWith(blobNamePrefix);
                 }
               });
   if (files == null || files.length == 0) {
     return ImmutableMap.of();
   }
   ImmutableMap.Builder<String, BlobMetaData> builder = ImmutableMap.builder();
   for (FileStatus file : files) {
     builder.put(
         file.getPath().getName(), new PlainBlobMetaData(file.getPath().getName(), file.getLen()));
   }
   return builder.build();
 }