本文整理汇总了Java中org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus.print方法的典型用法代码示例。如果您正苦于以下问题:Java SnapshottableDirectoryStatus.print方法的具体用法?Java SnapshottableDirectoryStatus.print怎么用?Java SnapshottableDirectoryStatus.print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus
的用法示例。
在下文中一共展示了SnapshottableDirectoryStatus.print方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus; //导入方法依赖的package包/类
@Override
public int run(String[] argv) throws Exception {
String description = "hdfs lsSnapshottableDir: \n" +
"\tGet the list of snapshottable directories that are owned by the current user.\n" +
"\tReturn all the snapshottable directories if the current user is a super user.\n";
if(argv.length != 0) {
System.err.println("Usage: \n" + description);
return 1;
}
FileSystem fs = FileSystem.get(getConf());
if (! (fs instanceof DistributedFileSystem)) {
System.err.println(
"LsSnapshottableDir can only be used in DistributedFileSystem");
return 1;
}
DistributedFileSystem dfs = (DistributedFileSystem) fs;
try {
SnapshottableDirectoryStatus[] stats = dfs.getSnapshottableDirListing();
SnapshottableDirectoryStatus.print(stats, System.out);
} catch (IOException e) {
String[] content = e.getLocalizedMessage().split("\n");
System.err.println("lsSnapshottableDir: " + content[0]);
return 1;
}
return 0;
}
示例2: run
import org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus; //导入方法依赖的package包/类
@Override
public int run(String[] argv) throws Exception {
String description = "LsSnapshottableDir: \n" +
"\tGet the list of snapshottable directories that are owned by the current user.\n" +
"\tReturn all the snapshottable directories if the current user is a super user.\n";
if(argv.length != 0) {
System.err.println("Usage: \n" + description);
return 1;
}
FileSystem fs = FileSystem.get(getConf());
if (! (fs instanceof DistributedFileSystem)) {
System.err.println(
"LsSnapshottableDir can only be used in DistributedFileSystem");
return 1;
}
DistributedFileSystem dfs = (DistributedFileSystem) fs;
try {
SnapshottableDirectoryStatus[] stats = dfs.getSnapshottableDirListing();
SnapshottableDirectoryStatus.print(stats, System.out);
} catch (IOException e) {
String[] content = e.getLocalizedMessage().split("\n");
System.err.println("lsSnapshottableDir: " + content[0]);
return 1;
}
return 0;
}
示例3: main
import org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus; //导入方法依赖的package包/类
public static void main(String[] argv) throws IOException {
String description = "LsSnapshottableDir: \n" +
"\tGet the list of snapshottable directories that are owned by the current user.\n" +
"\tReturn all the snapshottable directories if the current user is a super user.\n";
if(argv.length != 0) {
System.err.println("Usage: \n" + description);
System.exit(1);
}
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
if (! (fs instanceof DistributedFileSystem)) {
System.err.println(
"LsSnapshottableDir can only be used in DistributedFileSystem");
System.exit(1);
}
DistributedFileSystem dfs = (DistributedFileSystem) fs;
try {
SnapshottableDirectoryStatus[] stats = dfs.getSnapshottableDirListing();
SnapshottableDirectoryStatus.print(stats, System.out);
} catch (IOException e) {
String[] content = e.getLocalizedMessage().split("\n");
System.err.println("lsSnapshottableDir: " + content[0]);
}
}