Path parent = f.getParent(); if (parent != null) { if (!createParent && !exists(parent)) { throw new FileNotFoundException("Parent directory doesn't exist: " + parent); } else if (!mkdirs(parent)) { throw new IOException("Mkdirs failed to create " + parent + " (exists=" + exists(parent) + ", cwd=" + getWorkingDirectory() + ")");
Path parent = f.getParent(); if (parent != null) { if (!createParent && !exists(parent)) { throw new FileNotFoundException("Parent directory doesn't exist: " + parent); } else if (!mkdirs(parent)) { throw new IOException("Mkdirs failed to create " + parent + " (exists=" + exists(parent) + ", cwd=" + getWorkingDirectory() + ")");
Path parent = f.getParent(); if (parent != null) { if (!createParent && !exists(parent)) { throw new FileNotFoundException("Parent directory doesn't exist: " + parent); } else if (!mkdirs(parent)) { throw new IOException("Mkdirs failed to create " + parent + " (exists=" + exists(parent) + ", cwd=" + getWorkingDirectory() + ")");
Path parent = f.getParent(); if (parent != null) { if (!createParent && !exists(parent)) { throw new FileNotFoundException("Parent directory doesn't exist: " + parent); } else if (!mkdirs(parent)) { throw new IOException("Mkdirs failed to create " + parent + " (exists=" + exists(parent) + ", cwd=" + getWorkingDirectory() + ")");
Path parent = f.getParent(); if (parent != null) { if (!createParent && !exists(parent)) { throw new FileNotFoundException("Parent directory doesn't exist: " + parent); } else if (!mkdirs(parent)) { throw new IOException("Mkdirs failed to create " + parent + " (exists=" + exists(parent) + ", cwd=" + getWorkingDirectory() + ")");
private FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, boolean createParent, int bufferSize, short replication, long blockSize, int bytesPerChecksum, Progressable progress) throws IOException { Path parent = f.getParent(); if (parent != null) { if (!createParent && !exists(parent)) { throw new FileNotFoundException("Parent directory doesn't exist: " + parent); } else if (!mkdirs(parent)) { throw new IOException("Mkdirs failed to create " + parent); } } final FSDataOutputStream out = new FSDataOutputStream( new ChecksumFSOutputSummer(this, f, overwrite, bufferSize, replication, blockSize, bytesPerChecksum, progress), null); if (permission != null) { setPermission(f, permission); } return out; }
/** * Set replication for an existing file. * Implement the abstract <tt>setReplication</tt> of <tt>FileSystem</tt> * @param src file name * @param replication new replication * @throws IOException * @return true if successful; * false if file does not exist or is a directory */ public boolean setReplication(Path src, short replication) throws IOException { boolean value = fs.setReplication(src, replication); if (!value) return false; Path checkFile = getChecksumFile(src); if (exists(checkFile)) fs.setReplication(checkFile, replication); return true; }
/** * Set replication for an existing file. * Implement the abstract <tt>setReplication</tt> of <tt>FileSystem</tt> * @param src file name * @param replication new replication * @throws IOException * @return true if successful; * false if file does not exist or is a directory */ public boolean setReplication(Path src, short replication) throws IOException { boolean value = fs.setReplication(src, replication); if (!value) return false; Path checkFile = getChecksumFile(src); if (exists(checkFile)) fs.setReplication(checkFile, replication); return true; }