本文整理了Java中org.apache.flink.core.fs.Path.isAbsolute()
方法的一些代码示例,展示了Path.isAbsolute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.isAbsolute()
方法的具体详情如下:
包路径:org.apache.flink.core.fs.Path
类名称:Path
方法名:isAbsolute
[英]Checks if the directory of this path is absolute.
[中]
代码示例来源:origin: apache/flink
/**
* Adds a path to the artifact server.
* @param path the qualified FS path to serve (local, hdfs, etc).
* @param remoteFile the remote path with which to locate the file.
* @return the fully-qualified remote path to the file.
* @throws MalformedURLException if the remote path is invalid.
*/
public synchronized URL addPath(Path path, Path remoteFile) throws IOException, MalformedURLException {
if (paths.containsKey(remoteFile)) {
throw new IllegalArgumentException("duplicate path registered");
}
if (remoteFile.isAbsolute()) {
throw new IllegalArgumentException("not expecting an absolute path");
}
URL fileURL = new URL(baseURL, remoteFile.toString());
router.addAny(fileURL.getPath(), new VirtualFileServerHandler(path));
paths.put(remoteFile, fileURL);
return fileURL;
}
代码示例来源:origin: apache/flink
/**
* Converts the given Path to a File for this file system.
*
* <p>If the path is not absolute, it is interpreted relative to this FileSystem's working directory.
*/
public File pathToFile(Path path) {
if (!path.isAbsolute()) {
path = new Path(getWorkingDirectory(), path);
}
return new File(path.toUri().getPath());
}
代码示例来源:origin: apache/flink
public CompletedFuture(Path entry) {
try{
LocalFileSystem fs = (LocalFileSystem) FileSystem.getUnguardedFileSystem(entry.toUri());
result = entry.isAbsolute() ? new Path(entry.toUri().getPath()): new Path(fs.getWorkingDirectory(),entry);
} catch (Exception e){
throw new RuntimeException("DistributedCache supports only local files for Collection Environments");
}
}
代码示例来源:origin: apache/flink
/**
* Returns a qualified path object.
*
* @param fs
* the FileSystem that should be used to obtain the current working directory
* @return the qualified path object
*/
public Path makeQualified(FileSystem fs) {
Path path = this;
if (!isAbsolute()) {
path = new Path(fs.getWorkingDirectory(), this);
}
final URI pathUri = path.toUri();
final URI fsUri = fs.getUri();
String scheme = pathUri.getScheme();
String authority = pathUri.getAuthority();
if (scheme != null && (authority != null || fsUri.getAuthority() == null)) {
return path;
}
if (scheme == null) {
scheme = fsUri.getScheme();
}
if (authority == null) {
authority = fsUri.getAuthority();
if (authority == null) {
authority = "";
}
}
return new Path(scheme + ":" + "//" + authority + pathUri.getPath());
}
代码示例来源:origin: apache/flink
public VirtualFileServerHandler(Path path) throws IOException {
this.path = path;
if (!path.isAbsolute()) {
throw new IllegalArgumentException("path must be absolute: " + path.toString());
}
this.fs = path.getFileSystem();
if (!fs.exists(path) || fs.getFileStatus(path).isDir()) {
throw new IllegalArgumentException("no such file: " + path.toString());
}
}
代码示例来源:origin: apache/flink
assertTrue(p.isAbsolute());
assertTrue(p.isAbsolute());
assertFalse(p.isAbsolute());
assertFalse(p.isAbsolute());
assertTrue(p.isAbsolute());
assertTrue(p.isAbsolute());
assertTrue(p.isAbsolute());
assertTrue(p.isAbsolute());
assertTrue(p.isAbsolute());
assertTrue(p.isAbsolute());
assertFalse(p.isAbsolute());
assertTrue(p.isAbsolute());
assertFalse(p.isAbsolute());
assertTrue(p.isAbsolute());
assertTrue(p.isAbsolute());
代码示例来源:origin: com.alibaba.blink/flink-runtime
public Artifact(Path source, Path dest, boolean executable, boolean cachable, boolean extract) {
checkArgument(source.isAbsolute(), "source must be absolute");
checkArgument(!dest.isAbsolute(), "destination must be relative");
this.source = source;
this.dest = dest;
this.executable = executable;
this.cachable = cachable;
this.extract = extract;
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
public Artifact(Path source, Path dest, boolean executable, boolean cachable, boolean extract) {
checkArgument(source.isAbsolute(), "source must be absolute");
checkArgument(!dest.isAbsolute(), "destination must be relative");
this.source = source;
this.dest = dest;
this.executable = executable;
this.cachable = cachable;
this.extract = extract;
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
public Artifact(Path source, Path dest, boolean executable, boolean cachable, boolean extract) {
checkArgument(source.isAbsolute(), "source must be absolute");
checkArgument(!dest.isAbsolute(), "destination must be relative");
this.source = source;
this.dest = dest;
this.executable = executable;
this.cachable = cachable;
this.extract = extract;
}
代码示例来源:origin: org.apache.flink/flink-runtime
public Artifact(Path source, Path dest, boolean executable, boolean cachable, boolean extract) {
checkArgument(source.isAbsolute(), "source must be absolute");
checkArgument(!dest.isAbsolute(), "destination must be relative");
this.source = source;
this.dest = dest;
this.executable = executable;
this.cachable = cachable;
this.extract = extract;
}
代码示例来源:origin: org.apache.flink/flink-core
/**
* Converts the given Path to a File for this file system.
*
* <p>If the path is not absolute, it is interpreted relative to this FileSystem's working directory.
*/
public File pathToFile(Path path) {
if (!path.isAbsolute()) {
path = new Path(getWorkingDirectory(), path);
}
return new File(path.toUri().getPath());
}
代码示例来源:origin: com.alibaba.blink/flink-core
private File pathToFile(Path path) {
if (!path.isAbsolute()) {
path = new Path(getWorkingDirectory(), path);
}
return new File(path.toUri().getPath());
}
代码示例来源:origin: org.apache.flink/flink-core
/**
* Returns a qualified path object.
*
* @param fs
* the FileSystem that should be used to obtain the current working directory
* @return the qualified path object
*/
public Path makeQualified(FileSystem fs) {
Path path = this;
if (!isAbsolute()) {
path = new Path(fs.getWorkingDirectory(), this);
}
final URI pathUri = path.toUri();
final URI fsUri = fs.getUri();
String scheme = pathUri.getScheme();
String authority = pathUri.getAuthority();
if (scheme != null && (authority != null || fsUri.getAuthority() == null)) {
return path;
}
if (scheme == null) {
scheme = fsUri.getScheme();
}
if (authority == null) {
authority = fsUri.getAuthority();
if (authority == null) {
authority = "";
}
}
return new Path(scheme + ":" + "//" + authority + pathUri.getPath());
}
代码示例来源:origin: com.alibaba.blink/flink-core
/**
* Returns a qualified path object.
*
* @param fs
* the FileSystem that should be used to obtain the current working directory
* @return the qualified path object
*/
public Path makeQualified(FileSystem fs) {
Path path = this;
if (!isAbsolute()) {
path = new Path(fs.getWorkingDirectory(), this);
}
final URI pathUri = path.toUri();
final URI fsUri = fs.getUri();
String scheme = pathUri.getScheme();
String authority = pathUri.getAuthority();
if (scheme != null && (authority != null || fsUri.getAuthority() == null)) {
return path;
}
if (scheme == null) {
scheme = fsUri.getScheme();
}
if (authority == null) {
authority = fsUri.getAuthority();
if (authority == null) {
authority = "";
}
}
return new Path(scheme + ":" + "//" + authority + pathUri.getPath());
}
代码示例来源:origin: org.apache.flink/flink-core
public CompletedFuture(Path entry) {
try{
LocalFileSystem fs = (LocalFileSystem) FileSystem.getUnguardedFileSystem(entry.toUri());
result = entry.isAbsolute() ? new Path(entry.toUri().getPath()): new Path(fs.getWorkingDirectory(),entry);
} catch (Exception e){
throw new RuntimeException("DistributedCache supports only local files for Collection Environments");
}
}
代码示例来源:origin: com.alibaba.blink/flink-core
public CompletedFuture(Path entry) {
try{
LocalFileSystem fs = (LocalFileSystem) FileSystem.getUnguardedFileSystem(entry.toUri());
result = entry.isAbsolute() ? new Path(entry.toUri().getPath()): new Path(fs.getWorkingDirectory(),entry);
} catch (Exception e){
throw new RuntimeException("DistributedCache supports only local files for Collection Environments");
}
}
内容来源于网络,如有侵权,请联系作者删除!