/** * Recursively creates the directory specified by the provided path. * * @return <code>true</code>if the directories either already existed or have been created successfully, * <code>false</code> otherwise * @throws IOException * thrown if an error occurred while creating the directory/directories */ public boolean mkdirs(final Path f) throws IOException { final Path parent = f.getParent(); final File p2f = pathToFile(f); return (parent == null || mkdirs(parent)) && (p2f.mkdir() || p2f.isDirectory()); }
/** * Recursively creates the directory specified by the provided path. * * @return <code>true</code>if the directories either already existed or have been created successfully, * <code>false</code> otherwise * @throws IOException * thrown if an error occurred while creating the directory/directories */ public boolean mkdirs(final Path f) throws IOException { final Path parent = f.getParent(); final File p2f = pathToFile(f); return (parent == null || mkdirs(parent)) && (p2f.mkdir() || p2f.isDirectory()); }
/** * Adds a suffix to the final name in the path. * * @param suffix The suffix to be added * @return the new path including the suffix */ public Path suffix(String suffix) { return new Path(getParent(), getName() + suffix); }
/** * Adds a suffix to the final name in the path. * * @param suffix The suffix to be added * @return the new path including the suffix */ public Path suffix(String suffix) { return new Path(getParent(), getName() + suffix); }
@Override public FSDataOutputStream create(final Path f, final boolean overwrite, final int bufferSize, final short replication, final long blockSize) throws IOException { if (exists(f) && !overwrite) { throw new IOException("File already exists:" + f); } final Path parent = f.getParent(); if (parent != null && !mkdirs(parent)) { throw new IOException("Mkdirs failed to create " + parent.toString()); } final File file = pathToFile(f); return new LocalDataOutputStream(file); }
@Override public FSDataOutputStream create(final Path f, final boolean overwrite, final int bufferSize, final short replication, final long blockSize) throws IOException { if (exists(f) && !overwrite) { throw new IOException("File already exists:" + f); } final Path parent = f.getParent(); if (parent != null && !mkdirs(parent)) { throw new IOException("Mkdirs failed to create " + parent.toString()); } final File file = pathToFile(f); return new LocalDataOutputStream(file); }