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)
| 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. |