根据前缀获取文件列表的迭代器

@param bucket    空间名
@param prefix    文件名前缀
@param limit     每次迭代的长度限制，最大1000，推荐值 100
@param delimiter 指定目录分隔符，列出所有公共前缀（模拟列出目录效果）。缺省值为空字符串
@return FileInfo迭代器
972225
public FileListIterator createFileListIterator(String bucket, String prefix, int limit, String delimiter) {
        return new FileListIterator(bucket, prefix, limit, delimiter);
    }
517208
public File getTempFile(@NotNull final String prefix, @NotNull final String extension) throws IOException {
        final File dir = getTempDirectory();
        final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension);
        final File tempFile = new File(dir, tempFileName);
        if (tempFile.exists()) {
            return getTempFile(prefix, extension);
        }
        return tempFile;
    }
551122
protected final int nextStringEndPos(byte[] bytes, int startPos, int limit, byte[] delimiter) {
		int endPos = startPos;

		final int delimLimit = limit - delimiter.length + 1;

		while (endPos < limit) {
			if (endPos < delimLimit && delimiterNext(bytes, endPos, delimiter)) {
				break;
			}
			endPos++;
		}

		if (endPos == startPos) {
			setErrorState(ParseErrorState.EMPTY_COLUMN);
			return -1;
		}
		return endPos;
	}
417097
def keys(self, prefix=None, delimiter=None):
        
        if delimiter:
            # WE REALLY DO NOT GET KEYS, BUT RATHER Prefix OBJECTS
            # AT LEAST THEY ARE UNIQUE
            candidates = [k.name.rstrip(delimiter) for k in self.bucket.list(prefix=prefix, delimiter=delimiter)]
        else:
            candidates = [strip_extension(k.key) for k in self.bucket.list(prefix=prefix)]

        if prefix == None:
            return set(c for c in candidates if c != "0.json")
        else:
            return set(k for k in candidates if k == prefix or k.startswith(prefix + ".") or k.startswith(prefix + ":"))
1341925
def get_prefix(self):
        """"""
        prefix = self.bucket
        if self.prefix:
            prefix += self.delimiter + self.prefix
        return prefix
785214
@Override
  public List<String> listObjectNames(
      String bucketName, String objectNamePrefix, String delimiter)
      throws IOException {
    return listObjectNames(
        bucketName, objectNamePrefix, delimiter, GoogleCloudStorage.MAX_RESULTS_UNLIMITED);
  }
840209
def retrieve_keys(bucket, key, prefix='', postfix='', delim='/',
                      directories=False, recursive=False):
        
        if key and prefix:
            assert key.endswith(delim)

        key += prefix
        # check whether key is a directory
        if not key.endswith(delim) and key:
            # check for matching prefix
            if BotoClient.check_prefix(bucket, key + delim, delim=delim):
                # found a directory
                key += delim

        listdelim = delim if not recursive else None
        results = bucket.list(prefix=key, delimiter=listdelim)
        if postfix:
            func = lambda k_: BotoClient.filter_predicate(k_, postfix, inclusive=True)
            return filter(func, results)
        elif not directories:
            func = lambda k_: BotoClient.filter_predicate(k_, delim, inclusive=False)
            return filter(func, results)
        else:
            return results
774406
def get(self, url=None, delimiter="/"):
        
        params = {'Delimiter': delimiter}
        bucket, obj_key = _parse_url(url)

        if bucket:
            params['Bucket'] = bucket
        else:
            return self.call("ListBuckets", response_data_key="Buckets")

        if obj_key:
            params['Prefix'] = obj_key

        objects = self.call("ListObjects", response_data_key="Contents",
                            **params)
        if objects:
            for obj in objects:
                obj['url'] = "s3://{0}/{1}".format(bucket, obj['Key'])

        return objects
117239
public static int getNumberOfColumnsInFile(String filename, String delimiter) {
    try {
      BufferedReader in = new BufferedReader(new FileReader(filename));
      String line;
      while ((line = in.readLine()) != null) {
        String[] parts = line.split(delimiter);
        in.close();
        return parts.length;
      }
      in.close();
      // File is empty.
      return 0;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
820829
public static int getDelimIndex(StringBuilder sb, int itemPos, char[] delims, boolean ignoreEmpty) {

	if (StringUtil.isEmpty(sb)) return -1;

	int curr = -1, listIndex = 0;
	int len = sb.length();
	for (int i = 0; i < len; i++) {
	    if (contains(delims, sb.charAt(i))) {
		curr = i;
		if (ignoreEmpty) {
		    if (i == 0 || (i + 1 < len && contains(delims, sb.charAt(i + 1)))) {
			sb.delete(curr, curr + 1);
			len--;
			i--;
			curr--;
			continue;
		    }
		}
		if (++listIndex == itemPos) break;
	    }
	}
	if (listIndex < itemPos) return len;
	return curr;
    }
124698
public static Path getNextPath(String prefix) {
        Path path;

        do {
            path = Paths.get(String.format("%s%s", prefix, Integer.toString(nextDumpPathSuffix)));
            nextDumpPathSuffix++;
        } while (Files.exists(path));

        return path;
    }
691666
public static Collection<String> listFiles(String filesString, String delimiter) {
    ValidationUtils.validateNotEmpty(filesString, "fileStr");

    List<String> files = new ArrayList<String>();
    for (String fileString : filesString.split(delimiter)) {
      File file = new File(fileString);
      if (!file.getName().contains("*") && !file.getName().contains("?")) {
        files.add(file.getAbsolutePath());
        continue;
      }

      FileFilter fileFilter = new AndFileFilter(new WildcardFileFilter(file.getName()),
          FileFileFilter.FILE);
      File parent = file.getParentFile() == null ? file : file.getParentFile();
      File[] filteredFiles = parent.listFiles(fileFilter);
      if (filteredFiles == null) {
        continue;
      }

      for (File filteredFile : filteredFiles) {
        files.add(filteredFile.getAbsolutePath());
      }
    }
    return files;
  }
1056689
private boolean hasDelimiter(String word, String[] delimiters) {

        boolean delim = false;
        for (int i = 0; i < delimiters.length; i++) {
            if (word.indexOf(delimiters[i]) > -1) {
                delim = true;
                break;
            }
        }
        return delim;
    }
1331464
public Bucket getBucket(String bucket) {
        if (bucket.contains("..") || bucket.contains("/") || bucket.contains("\\")) {
            throw Exceptions.createHandled()
                            .withSystemErrorMessage(
                                    "Invalid bucket name: %s. A bucket name must not contain '..' '/' or '\\'",
                                    bucket)
                            .handle();
        }
        return new Bucket(new File(getBaseDir(), bucket));
    }
354558
@Override
    public Iterator<String> getSpaceContents(String spaceId, String prefix) {
        ConnectOperation co =
            new ConnectOperation(host, port, username, password, zone);

        String path;
        if (prefix != null && !prefix.equals("")) {
            path = baseDirectory + "/" + spaceId + "/" + prefix;
        } else {
            path = baseDirectory + "/" + spaceId;
        }

        log.trace("listing space contents for " + path);
        try {
            return listRecursiveFiles(path, co.getConnection());
        } catch (IOException e) {
            log.error("Could not connect to iRODS", e);
            throw new StorageException(e);
        }
    }
17146
public Csv arrayElementDelimiter(String delimiter) {
		Preconditions.checkNotNull(delimiter);
		internalProperties.putString(FORMAT_ARRAY_ELEMENT_DELIMITER, delimiter);
		return this;
	}
589382
public float getRequstURIPath(String prefix, float defvalue) {
        String val = getRequstURIPath(prefix, null);
        try {
            return val == null ? defvalue : Float.parseFloat(val);
        } catch (NumberFormatException e) {
            return defvalue;
        }
    }