MCPcopy Create free account
hub / github.com/apache/pig / listPaths

Method listPaths

src/org/apache/pig/PigServer.java:1313–1328  ·  view source on GitHub ↗

List the contents of a directory. @param dir name of directory to list @return array of strings, one for each file name @throws IOException

(String dir)

Source from the content-addressed store, hash-verified

1311 * @throws IOException
1312 */
1313 public String[] listPaths(String dir) throws IOException {
1314 // Check if this operation is permitted
1315 filter.validate(PigCommandFilter.Command.LS);
1316
1317 Collection<String> allPaths = new ArrayList<String>();
1318 ContainerDescriptor container = pigContext.getDfs().asContainer(dir);
1319 Iterator<ElementDescriptor> iter = container.iterator();
1320
1321 while (iter.hasNext()) {
1322 ElementDescriptor elem = iter.next();
1323 allPaths.add(elem.toString());
1324 }
1325
1326 String[] type = new String[1];
1327 return allPaths.toArray(type);
1328 }
1329
1330 /**
1331 * Return a map containing the logical plan associated with each alias.

Callers 1

Calls 9

getDfsMethod · 0.80
toArrayMethod · 0.80
validateMethod · 0.65
asContainerMethod · 0.65
iteratorMethod · 0.65
addMethod · 0.65
hasNextMethod · 0.45
nextMethod · 0.45
toStringMethod · 0.45

Tested by 1