List of usage examples for org.apache.hadoop.fs HarFileSystem listStatus
@Override public FileStatus[] listStatus(Path f) throws IOException
From source file:com.github.dongjinleekr.hadoop.examples.DistributedCacheExample.java
License:Apache License
public static void printCachePath(Configuration conf) throws IOException, URISyntaxException { FileSystem fs = FileSystem.get(conf); URI[] archives = DistributedCache.getCacheArchives(conf); for (URI archive : archives) { HarFileSystem hfs = new HarFileSystem(); String cacheUri = String.format("har://hdfs-%s:%d%s", fs.getUri().getHost(), fs.getUri().getPort(), archive.toString());//from w w w. jav a2 s . c o m System.out.println(cacheUri); hfs.initialize(new URI(cacheUri), conf); FileStatus root = hfs.listStatus(new Path("."))[0]; FileStatus[] children = hfs.listStatus(root.getPath()); for (FileStatus child : children) { System.out.println(child.getPath()); } IOUtils.closeStream(hfs); } }