code: public int countObjects(@Nonnull String query) {
          try (Stream<Path> stream = Files.list(file.toPath())) {
              return Math.toIntExact(stream.map(Path::toFile)
                                           .filter(currentFile -> isMatchingObject(query, currentFile))
                                           .count());
          } catch (IOException e) {
              throw Exceptions.handle(e);
          }
      }
docs: Count the files containing the query. Leave the query empty to count all files.
  
  @param query the query to filter for
  @return the number of files in the bucket matching the query