/** * Creates a <code>LocalFileStatus</code> object from a given {@link File} object. * * @param f * the {@link File} object this <code>LocalFileStatus</code> refers to * @param fs * the file system the corresponding file has been read from */ public LocalFileStatus(final File f, final FileSystem fs) { this.file = f; this.path = new Path(fs.getUri().getScheme() + ":" + f.toURI().getPath()); }
/** * Creates a <code>LocalFileStatus</code> object from a given {@link File} object. * * @param f * the {@link File} object this <code>LocalFileStatus</code> refers to * @param fs * the file system the corresponding file has been read from */ public LocalFileStatus(final File f, final FileSystem fs) { this.file = f; this.path = new Path(fs.getUri().getScheme() + ":" + f.toURI().getPath()); }
/** * 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()); }
/** * 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()); }