org.apache.beam.sdk.io.FileSystems.getFileSystemInternal()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.apache.beam.sdk.io.FileSystems.getFileSystemInternal()方法的一些代码示例,展示了FileSystems.getFileSystemInternal()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileSystems.getFileSystemInternal()方法的具体详情如下:
包路径:org.apache.beam.sdk.io.FileSystems
类名称:FileSystems
方法名:getFileSystemInternal

FileSystems.getFileSystemInternal介绍

[英]Internal method to get FileSystem for scheme.
[中]获取方案文件系统的内部方法。

代码示例

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

/** Like {@link #match(List)}, but with a configurable {@link EmptyMatchTreatment}. */
public static List<MatchResult> match(List<String> specs, EmptyMatchTreatment emptyMatchTreatment)
  throws IOException {
 List<MatchResult> matches = getFileSystemInternal(getOnlyScheme(specs)).match(specs);
 List<MatchResult> res = Lists.newArrayListWithExpectedSize(matches.size());
 for (int i = 0; i < matches.size(); i++) {
  res.add(maybeAdjustEmptyMatchResult(specs.get(i), matches.get(i), emptyMatchTreatment));
 }
 return res;
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

/**
 * Returns a read channel for the given {@link ResourceId}.
 *
 * <p>The resource is not expanded; it is used verbatim.
 *
 * <p>If seeking is supported, then this returns a {@link java.nio.channels.SeekableByteChannel}.
 *
 * @param resourceId the reference of the file-like resource to open
 */
public static ReadableByteChannel open(ResourceId resourceId) throws IOException {
 return getFileSystemInternal(resourceId.getScheme()).open(resourceId);
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

/**
 * Returns a write channel for the given {@link ResourceId} with {@link CreateOptions}.
 *
 * <p>The resource is not expanded; it is used verbatim.
 *
 * @param resourceId the reference of the file-like resource to create
 * @param createOptions the configuration of the create operation
 */
public static WritableByteChannel create(ResourceId resourceId, CreateOptions createOptions)
  throws IOException {
 return getFileSystemInternal(resourceId.getScheme()).create(resourceId, createOptions);
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

/**
  * Returns a new {@link ResourceId} that represents the named resource of a type corresponding to
  * the resource type.
  *
  * <p>The supplied {@code singleResourceSpec} is expected to be in a proper format, including any
  * necessary escaping, for the underlying {@link FileSystem}.
  *
  * <p>This function may throw an {@link IllegalArgumentException} if given an invalid argument,
  * such as when the specified {@code singleResourceSpec} is not a valid resource name.
  */
 public static ResourceId matchNewResource(String singleResourceSpec, boolean isDirectory) {
  return getFileSystemInternal(parseScheme(singleResourceSpec))
    .matchNewResource(singleResourceSpec, isDirectory);
 }
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

return getFileSystemInternal(getOnlyScheme(specs)).match(specs);

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

return;
getFileSystemInternal(srcToCopy.iterator().next().getScheme()).copy(srcToCopy, destToCopy);

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

return;
getFileSystemInternal(srcToRename.iterator().next().getScheme())
  .rename(srcToRename, destToRename);

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

return;
getFileSystemInternal(resourceIdsToDelete.iterator().next().getScheme())
  .delete(resourceIdsToDelete);

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

@Test
public void testGetLocalFileSystem() throws Exception {
 assertTrue(
   FileSystems.getFileSystemInternal(toLocalResourceId("~/home/").getScheme())
     instanceof LocalFileSystem);
 assertTrue(
   FileSystems.getFileSystemInternal(toLocalResourceId("file://home").getScheme())
     instanceof LocalFileSystem);
 assertTrue(
   FileSystems.getFileSystemInternal(toLocalResourceId("FILE://home").getScheme())
     instanceof LocalFileSystem);
 assertTrue(
   FileSystems.getFileSystemInternal(toLocalResourceId("File://home").getScheme())
     instanceof LocalFileSystem);
 if (SystemUtils.IS_OS_WINDOWS) {
  assertTrue(
    FileSystems.getFileSystemInternal(toLocalResourceId("c:\\home\\").getScheme())
      instanceof LocalFileSystem);
 }
}

相关文章