本文整理了Java中org.uberfire.java.nio.file.FileSystems
类的一些代码示例,展示了FileSystems
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileSystems
类的具体详情如下:
包路径:org.uberfire.java.nio.file.FileSystems
类名称:FileSystems
[英]Back port of JSR-203 from Java Platform, Standard Edition 7.
[中]Java平台JSR-203的后端口,标准版7。
代码示例来源:origin: org.uberfire/backend-server
@Override
public FileSystem newFileSystem(final String uri, final Map<String, Object> env)
throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException {
final URI furi = URI.create(uri);
final org.uberfire.java.nio.file.FileSystem newFileSystem = FileSystems.newFileSystem(furi, env);
return new FileSystemImpl(asList(new Path[]{new PathImpl(furi.getPath(), uri)}));
}
代码示例来源:origin: kiegroup/appformer
@Override
public FileSystem newFileSystem(final URI uri,
final Map<String, ?> env) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException {
try {
final FileSystem fs = FileSystems.newFileSystem(uri,
env);
return registerFS(fs);
} catch (final FileSystemAlreadyExistsException ex) {
registerFS(FileSystems.getFileSystem(uri));
throw ex;
}
}
代码示例来源:origin: org.uberfire/vfs-api
/**
* @throws IllegalArgumentException
* @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html#get(java.lang.String, java.lang.String...)">JDK JavaDoc</a>
*/
public static Path get(final String first, final String... more)
throws IllegalArgumentException {
checkNotNull("first", first);
if (first.trim().length() == 0) {
return FileSystems.getDefault().getPath(first);
}
URI uri = null;
if (more == null || more.length == 0) {
try {
uri = new URI(first);
} catch (URISyntaxException ex) {
try {
uri = URI.create(first);
} catch (IllegalArgumentException e) {
uri = null;
}
}
}
if (uri != null && uri.getScheme() != null) {
return get(uri);
}
return FileSystems.getDefault().getPath(first, more);
}
代码示例来源:origin: kiegroup/appformer
@Override
public FileSystem getFileSystem(final URI uri) {
try {
return registerFS(FileSystems.getFileSystem(uri));
} catch (final Exception ex) {
logger.error("Failed to register filesystem " + uri + " with DEFAULT_FS_TYPE. Returning null.",
ex);
return null;
}
}
代码示例来源:origin: kiegroup/appformer
@Test
public void getFileSystemNull() {
assertThatThrownBy(() -> FileSystems.getFileSystem(null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Parameter named 'uri' should be not null!");
}
代码示例来源:origin: org.uberfire/vfs-api
/**
* @throws IllegalArgumentException
* @throws ProviderNotFoundException
* @throws ServiceConfigurationError
* @throws IOException
* @throws SecurityException
* @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.nio.file.Path, java.lang.ClassLoader)">Original JavaDoc</a>
*/
public static FileSystem newFileSystem(final Path path, final ClassLoader loader)
throws IllegalArgumentException, ProviderNotFoundException, ServiceConfigurationError, IOException, SecurityException {
checkNotNull("path", path);
final Map<String, ?> env = emptyMap();
return newFileSystem(path.toUri(), env, null);
}
代码示例来源:origin: org.guvnor/guvnor-ala-source-git
final URI fsURI = URI.create("git://" + name);
try {
fileSystem = FileSystems.newFileSystem(fsURI,
new HashMap<String, Object>(env) {
} catch (FileSystemAlreadyExistsException fsae) {
try {
fileSystem = FileSystems.getFileSystem(fsURI);
} catch (final Exception ex) {
throw new SourcingException("Error Getting Source",
代码示例来源:origin: kiegroup/appformer
@Test
public void testGetFileSystemByURI() {
assertThat(FileSystems.getFileSystem(URI.create("default:///"))).isInstanceOf(BaseSimpleFileSystem.class);
assertThat(FileSystems.getFileSystem(URI.create("file:///"))).isInstanceOf(BaseSimpleFileSystem.class);
}
代码示例来源:origin: org.uberfire/uberfire-nio2-api
/**
* @throws IllegalArgumentException
* @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html#get(java.lang.String, java.lang.String...)">JDK JavaDoc</a>
*/
public static Path get(final String first,
final String... more)
throws IllegalArgumentException {
checkNotNull("first",
first);
if (first.trim().length() == 0) {
return FileSystems.getDefault().getPath(first);
}
URI uri = null;
if (more == null || more.length == 0) {
try {
uri = new URI(first);
} catch (URISyntaxException ex) {
try {
uri = URI.create(first);
} catch (IllegalArgumentException e) {
uri = null;
}
}
}
if (uri != null && uri.getScheme() != null) {
return get(uri);
}
return FileSystems.getDefault().getPath(first,
more);
}
代码示例来源:origin: org.uberfire/uberfire-nio2-api
/**
* @throws IllegalArgumentException
* @throws ProviderNotFoundException
* @throws ServiceConfigurationError
* @throws IOException
* @throws SecurityException
* @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.nio.file.Path, java.lang.ClassLoader)">Original JavaDoc</a>
*/
public static FileSystem newFileSystem(final Path path,
final ClassLoader loader)
throws IllegalArgumentException, ProviderNotFoundException, ServiceConfigurationError, IOException, SecurityException {
checkNotNull("path",
path);
final Map<String, ?> env = emptyMap();
return newFileSystem(path.toUri(),
env,
null);
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
final URI fs = new URI("git://test");
try {
FileSystems.getFileSystem(fs);
} catch (FileSystemNotFoundException e) {
FileSystems.newFileSystem(fs,
new HashMap<String, Object>());
when(nioPath.resolve(any(String.class))).thenReturn(nioPath);
when(nioPath.toUri()).thenReturn(URI.create("git://test/p0/pom.xml"));
when(nioPath.getFileSystem()).thenReturn(FileSystems.getFileSystem(fs));
when(ioService.get(any(URI.class))).thenReturn(nioPath);
代码示例来源:origin: org.guvnor/guvnor-ala-build-maven
@Override
public Optional<BinaryConfig> apply(final MavenBuild mavenBuild,
final MavenBuildExecConfig mavenBuildExecConfig) {
final Project project = mavenBuild.getProject();
final MavenProject mavenProject = build(project,
mavenBuild.getGoals(),
mavenBuild.getProperties());
final Path path = FileSystems.getFileSystem(URI.create("file://default")).getPath(project.getTempDir() + "/target/" + project.getExpectedBinary());
final MavenBinary binary = new MavenProjectBinaryImpl(
path,
project,
mavenProject.getGroupId(),
mavenProject.getArtifactId(),
mavenProject.getVersion());
buildRegistry.registerBinary(binary);
return Optional.of(binary);
}
代码示例来源:origin: kiegroup/appformer
/**
* @throws IllegalArgumentException
* @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html#get(java.lang.String, java.lang.String...)">JDK JavaDoc</a>
*/
public static Path get(final String first,
final String... more)
throws IllegalArgumentException {
checkNotNull("first",
first);
if (first.trim().length() == 0) {
return FileSystems.getDefault().getPath(first);
}
URI uri = null;
if (more == null || more.length == 0) {
try {
uri = new URI(first);
} catch (URISyntaxException ex) {
try {
uri = URI.create(first);
} catch (IllegalArgumentException e) {
uri = null;
}
}
}
if (uri != null && uri.getScheme() != null) {
return get(uri);
}
return FileSystems.getDefault().getPath(first,
more);
}
代码示例来源:origin: kiegroup/appformer
/**
* @throws IllegalArgumentException
* @throws ProviderNotFoundException
* @throws ServiceConfigurationError
* @throws IOException
* @throws SecurityException
* @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.nio.file.Path, java.lang.ClassLoader)">Original JavaDoc</a>
*/
public static FileSystem newFileSystem(final Path path,
final ClassLoader loader)
throws IllegalArgumentException, ProviderNotFoundException, ServiceConfigurationError, IOException, SecurityException {
checkNotNull("path",
path);
final Map<String, ?> env = emptyMap();
return newFileSystem(path.toUri(),
env,
null);
}
代码示例来源:origin: org.guvnor/guvnor-ala-source-git
if (Boolean.parseBoolean(gitConfig.getCreateRepo())) {
final URI uri = URI.create("git://" + gitConfig.getRepoName());
FileSystems.newFileSystem(uri,
new HashMap<String, Object>() {
final URI uri = URI.create("git://" + gitConfig.getRepoName() + "?sync");
try {
FileSystems.getFileSystem(uri);
} catch (Exception ex) {
代码示例来源:origin: org.guvnor/guvnor-ala-build-maven
@Override
public Optional<MavenBinary> apply(final MavenDependencyConfig config) {
final String artifactId = config.getArtifact();
checkNotEmpty("artifact parameter is mandatory",
artifactId);
LOGGER.debug("Resolving Artifact: {}",
artifactId);
final Artifact artifact = resolveArtifact(artifactId);
if (artifact == null) {
throw new RuntimeException("Cannot resolve Maven artifact. Look at the previous logs for more information.");
}
final String absolutePath = artifact.getFile().getAbsolutePath();
LOGGER.debug("Resolved Artifact path: {}",
absolutePath);
final Path path = FileSystems.getFileSystem(URI.create("file://default")).getPath(absolutePath);
final MavenBinary binary = new MavenBinaryImpl(path,
artifact.getArtifactId(),
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getVersion());
buildRegistry.registerBinary(binary);
return Optional.of(binary);
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testGetDefault() {
assertThat(FileSystems.getDefault())
.isInstanceOf(BaseSimpleFileSystem.class);
}
代码示例来源:origin: org.uberfire/vfs-api
/**
* @throws IllegalArgumentException
* @throws FileSystemAlreadyExistsException
* @throws ProviderNotFoundException
* @throws IOException
* @throws SecurityException
* @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.net.URI, java.util.Map)">Original JavaDoc</a>
*/
public static FileSystem newFileSystem(final URI uri, final Map<String, ?> env)
throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException,
IOException, SecurityException {
checkNotNull("uri", uri);
checkNotNull("env", env);
return newFileSystem(uri, env, null);
}
代码示例来源:origin: org.kie.workbench/kie-wb-common-ala-build-maven
final FileSystem fs = FileSystems.getFileSystem(originRepo);
代码示例来源:origin: org.uberfire/uberfire-nio2-api
/**
* @throws IllegalArgumentException
* @throws FileSystemAlreadyExistsException
* @throws ProviderNotFoundException
* @throws IOException
* @throws SecurityException
* @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.net.URI, java.util.Map)">Original JavaDoc</a>
*/
public static FileSystem newFileSystem(final URI uri,
final Map<String, ?> env)
throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException,
IOException, SecurityException {
checkNotNull("uri",
uri);
checkNotNull("env",
env);
return newFileSystem(uri,
env,
null);
}
内容来源于网络,如有侵权,请联系作者删除!