/** * Returns a list of PathData objects of the items contained in the given * directory. * @return list of PathData objects for its children * @throws IOException if anything else goes wrong... */ public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { // preserve relative paths String child = getStringForChildPath(stats[i].getPath()); items[i] = new PathData(fs, child, stats[i]); } Arrays.sort(items); return items; }
/** * Creates a new object for a child entry in this directory * @param child the basename will be appended to this object's path * @return PathData for the child * @throws IOException if this object does not exist or is not a directory */ public PathData getPathDataForChild(PathData child) throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); return new PathData(fs, getStringForChildPath(child.path)); }
/** * Returns a list of PathData objects of the items contained in the given * directory. * @return list of PathData objects for its children * @throws IOException if anything else goes wrong... */ public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { // preserve relative paths String child = getStringForChildPath(stats[i].getPath()); items[i] = new PathData(fs, child, stats[i]); } Arrays.sort(items); return items; }
/** * Returns a list of PathData objects of the items contained in the given * directory. * @return list of PathData objects for its children * @throws IOException if anything else goes wrong... */ public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { // preserve relative paths String child = getStringForChildPath(stats[i].getPath()); items[i] = new PathData(fs, child, stats[i]); } Arrays.sort(items); return items; }
/** * Returns a list of PathData objects of the items contained in the given * directory. * @return list of PathData objects for its children * @throws IOException if anything else goes wrong... */ public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { // preserve relative paths String child = getStringForChildPath(stats[i].getPath()); items[i] = new PathData(fs, child, stats[i]); } Arrays.sort(items); return items; }
/** * Returns a list of PathData objects of the items contained in the given * directory. * @return list of PathData objects for its children * @throws IOException if anything else goes wrong... */ public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { // preserve relative paths String child = getStringForChildPath(stats[i].getPath()); items[i] = new PathData(fs, child, stats[i]); } Arrays.sort(items); return items; }
/** * Creates a new object for a child entry in this directory * @param child the basename will be appended to this object's path * @return PathData for the child * @throws IOException if this object does not exist or is not a directory */ public PathData getPathDataForChild(PathData child) throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); return new PathData(fs, getStringForChildPath(child.path)); }
/** * Creates a new object for a child entry in this directory * @param child the basename will be appended to this object's path * @return PathData for the child * @throws IOException if this object does not exist or is not a directory */ public PathData getPathDataForChild(PathData child) throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); return new PathData(fs, getStringForChildPath(child.path)); }
/** * Creates a new object for a child entry in this directory * @param child the basename will be appended to this object's path * @return PathData for the child * @throws IOException if this object does not exist or is not a directory */ public PathData getPathDataForChild(PathData child) throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); return new PathData(fs, getStringForChildPath(child.path)); }
/** * Creates a new object for a child entry in this directory * @param child the basename will be appended to this object's path * @return PathData for the child * @throws IOException if this object does not exist or is not a directory */ public PathData getPathDataForChild(PathData child) throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); return new PathData(fs, getStringForChildPath(child.path)); }