当前位置: 首页>>代码示例>>Java>>正文


Java GlobPattern类代码示例

本文整理汇总了Java中org.apache.hadoop.fs.GlobPattern的典型用法代码示例。如果您正苦于以下问题:Java GlobPattern类的具体用法?Java GlobPattern怎么用?Java GlobPattern使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GlobPattern类属于org.apache.hadoop.fs包,在下文中一共展示了GlobPattern类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepare

import org.apache.hadoop.fs.GlobPattern; //导入依赖的package包/类
@Override
public void prepare() throws IOException {
  String argPattern = getArgument(1);
  if (!caseSensitive) {
    argPattern = StringUtils.toLowerCase(argPattern);
  }
  globPattern = new GlobPattern(argPattern);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:9,代码来源:Name.java

示例2: init

import org.apache.hadoop.fs.GlobPattern; //导入依赖的package包/类
void init(String filePattern, PathFilter filter) throws IOException {
  try {
    userFilter = filter;
    pattern = new GlobPattern(filePattern);
  } catch (PatternSyntaxException e) {
    throw new IOException("Illegal file pattern: " + e.getMessage(), e);
  }
}
 
开发者ID:SparkTC,项目名称:stocator,代码行数:9,代码来源:ObjectStoreGlobFilter.java

示例3: getFirstMatch

import org.apache.hadoop.fs.GlobPattern; //导入依赖的package包/类
public static Path getFirstMatch(FileSystem fs, Path path, String globPatternStr, boolean recursive)
    throws IOException
{
    RemoteIterator<LocatedFileStatus> files = fs.listFiles(path, recursive);
    GlobPattern globPattern = new GlobPattern(globPatternStr);

    while (files.hasNext())
    {
        Path aFile = files.next().getPath();
        if(globPattern.matches(aFile.getName()))
            return aFile;
    }

    return null;
}
 
开发者ID:linkedin,项目名称:Cubert,代码行数:16,代码来源:FileSystemUtils.java

示例4: compile

import org.apache.hadoop.fs.GlobPattern; //导入依赖的package包/类
@Override
protected Pattern compile(String s) {
  return GlobPattern.compile(s);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:5,代码来源:GlobFilter.java

示例5: shouldUseFlatGlob

import org.apache.hadoop.fs.GlobPattern; //导入依赖的package包/类
/**
 * Determines based on config settings and suitability of {@code fixedPath} whether to use
 * flat globbing logic where we use a single large listing during globStatus to then perform
 * the core globbing logic in-memory.
 */
@VisibleForTesting
boolean shouldUseFlatGlob(Path fixedPath) {
  // Config setting overrides all else.
  if (!enableFlatGlob) {
    return false;
  }

  // Only works for filesystems where the base Hadoop Path scheme matches the underlying URI
  // scheme for GCS.
  if (!getUri().getScheme().equals(GoogleCloudStorageFileSystem.SCHEME)) {
    LOG.debug(
        "Flat glob is on, but doesn't work for scheme '{}'; using default behavior.",
        getUri().getScheme());
    return false;
  }

  // The full pattern should have a wildcard, otherwise there's no point doing the flat glob.
  GlobPattern fullPattern = new GlobPattern(fixedPath.toString());
  if (!fullPattern.hasWildcard()) {
    LOG.debug(
        "Flat glob is on, but Path '{}' has no wildcard; using default behavior.",
        fixedPath);
    return false;
  }

  // To use a flat glob, there must be an authority defined.
  if (Strings.isNullOrEmpty(fixedPath.toUri().getAuthority())) {
    LOG.info(
        "Flat glob is on, but Path '{}' has a empty authority, using default behavior.",
        fixedPath);
    return false;
  }

  // And the authority must not contain a wildcard.
  GlobPattern authorityPattern = new GlobPattern(fixedPath.toUri().getAuthority());
  if (authorityPattern.hasWildcard()) {
    LOG.info(
        "Flat glob is on, but Path '{}' has a wildcard authority, using default behavior.",
        fixedPath);
    return false;
  }

  return true;
}
 
开发者ID:GoogleCloudPlatform,项目名称:bigdata-interop,代码行数:50,代码来源:GoogleHadoopFileSystemBase.java

示例6: compile

import org.apache.hadoop.fs.GlobPattern; //导入依赖的package包/类
/**
 * Compile glob pattern string
 *
 * @param globPattern the glob pattern
 * @return the pattern object
 */
public static Pattern compile(String globPattern) {
  return new GlobPattern(globPattern).compiled();
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:10,代码来源:PathGlobPattern.java


注:本文中的org.apache.hadoop.fs.GlobPattern类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。