本文整理汇总了Java中org.apache.hadoop.fs.PathIsDirectoryException类的典型用法代码示例。如果您正苦于以下问题:Java PathIsDirectoryException类的具体用法?Java PathIsDirectoryException怎么用?Java PathIsDirectoryException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathIsDirectoryException类属于org.apache.hadoop.fs包,在下文中一共展示了PathIsDirectoryException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processPath
import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
if (item.stat.isDirectory() && !deleteDirs) {
throw new PathIsDirectoryException(item.toString());
}
// TODO: if the user wants the trash to be used but there is any
// problem (ie. creating the trash dir, moving the item to be deleted,
// etc), then the path will just be deleted because moveToTrash returns
// false and it falls thru to fs.delete. this doesn't seem right
if (moveToTrash(item) || !canBeSafelyDeleted(item)) {
return;
}
if (!item.fs.delete(item.path, deleteDirs)) {
throw new PathIOException(item.toString());
}
out.println("Deleted " + item);
}
示例2: processPath
import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
if(item.stat.isDirectory()) {
throw new PathIsDirectoryException(item.toString());
}
long oldLength = item.stat.getLen();
if(newLength > oldLength) {
throw new IllegalArgumentException(
"Cannot truncate to a larger file size. Current size: " + oldLength +
", truncate size: " + newLength + ".");
}
if(item.fs.truncate(item.path, newLength)) {
out.println("Truncated " + item + " to length: " + newLength);
}
else if(waitOpt) {
waitList.add(item);
}
else {
out.println("Truncating " + item + " to length: " + newLength + ". " +
"Wait for block recovery to complete before further updating this " +
"file.");
}
}
示例3: processPath
import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
if (item.stat.isDirectory()) {
throw new PathIsDirectoryException(item.toString());
}
FileChecksum checksum = item.fs.getFileChecksum(item.path);
if (checksum == null) {
out.printf("%s\tNONE\t%n", item.toString());
} else {
String checksumString = StringUtils.byteToHexString(
checksum.getBytes(), 0, checksum.getLength());
out.printf("%s\t%s\t%s%n",
item.toString(), checksum.getAlgorithmName(),
checksumString);
}
}
示例4: processOptions
import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
try {
CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "nl",
"skip-empty-file");
cf.parse(args);
delimiter = cf.getOpt("nl") ? "\n" : null;
skipEmptyFileDelimiter = cf.getOpt("skip-empty-file");
dst = new PathData(new URI(args.removeLast()), getConf());
if (dst.exists && dst.stat.isDirectory()) {
throw new PathIsDirectoryException(dst.toString());
}
srcs = new LinkedList<PathData>();
} catch (URISyntaxException e) {
throw new IOException("unexpected URISyntaxException", e);
}
}
示例5: processPath
import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
if (item.stat.isDirectory()) {
throw new PathIsDirectoryException(item.toString());
}
long offset = dumpFromOffset(item, startingOffset);
while (follow) {
try {
Thread.sleep(followDelay);
} catch (InterruptedException e) {
break;
}
offset = dumpFromOffset(item, offset);
}
}
示例6: processPath
import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
if (item.stat.isDirectory() && !deleteDirs) {
throw new PathIsDirectoryException(item.toString());
}
// TODO: if the user wants the trash to be used but there is any
// problem (ie. creating the trash dir, moving the item to be deleted,
// etc), then the path will just be deleted because moveToTrash returns
// false and it falls thru to fs.delete. this doesn't seem right
if (moveToTrash(item)) {
return;
}
if (!item.fs.delete(item.path, deleteDirs)) {
throw new PathIOException(item.toString());
}
out.println("Deleted " + item);
}
示例7: processOptions
import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
try {
CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "nl");
cf.parse(args);
delimiter = cf.getOpt("nl") ? "\n" : null;
dst = new PathData(new URI(args.removeLast()), getConf());
if (dst.exists && dst.stat.isDirectory()) {
throw new PathIsDirectoryException(dst.toString());
}
srcs = new LinkedList<PathData>();
} catch (URISyntaxException e) {
throw new IOException("unexpected URISyntaxException", e);
}
}
示例8: processPath
import org.apache.hadoop.fs.PathIsDirectoryException; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
if (item.stat.isDirectory()) {
throw new PathIsDirectoryException(item.toString());
}
FileChecksum checksum = item.fs.getFileChecksum(item.path);
if (checksum == null) {
out.printf("%s\tNONE\t\n", item.toString());
} else {
String checksumString = StringUtils.byteToHexString(
checksum.getBytes(), 0, checksum.getLength());
out.printf("%s\t%s\t%s\n",
item.toString(), checksum.getAlgorithmName(),
checksumString);
}
}