You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Andrew Wang (JIRA)" <ji...@apache.org> on 2014/12/17 20:43:15 UTC

[jira] [Commented] (HDFS-7540) Add IOUtils#listDirectory

    [ https://issues.apache.org/jira/browse/HDFS-7540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14250388#comment-14250388 ] 

Andrew Wang commented on HDFS-7540:
-----------------------------------

Thanks for working on this Colin. It'll be nice to swap this in where we can, JDK7 does a much better job at exposing filesystem APIs.

I wonder if we should really return a ChunkedArrayList here. It only implements a subset of the AbstractList interface, and this is a pretty general-purpose method. For huge dirs, we should probably just be using the DirectoryStream iterator directly. I do see the use of these helper functions for quick-and-dirty listings though.

I'd be okay providing variants of these functions that return a ChunkedArrayList, but it seems like the default should just be a normal ArrayList.

Couple other things:

* Need {{<p/>}} tag for javadoc linebreak
* I read the docs at http://docs.oracle.com/javase/7/docs/api/java/nio/file/DirectoryStream.html and it'd be nice to do like the example and unwrap the DirectoryIteratorException into an IOException.

> Add IOUtils#listDirectory
> -------------------------
>
>                 Key: HDFS-7540
>                 URL: https://issues.apache.org/jira/browse/HDFS-7540
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 2.7.0
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>         Attachments: HDFS-7540.001.patch
>
>
> We should have a drop-in replacement for File#listDir that doesn't hide IOExceptions, and which returns a ChunkedArrayList rather than a single large array.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)