jdk/src/share/classes/java/nio/file/DirectoryStream.java
author ohair
Wed, 06 Apr 2011 22:06:11 -0700
changeset 9035 1255eb81cc2f
parent 8158 77d9c0f1c19f
child 15647 314007859004
permissions -rw-r--r--
7033660: Update copyright year to 2011 on any files changed in 2011 Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 8158
diff changeset
     2
 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     4
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3419
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3419
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    10
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    15
 * accompanied this code).
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    16
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3419
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3419
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3419
diff changeset
    23
 * questions.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    24
 */
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    25
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    26
package java.nio.file;
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    27
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    28
import java.util.Iterator;
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    29
import java.io.Closeable;
3065
452aaa2899fc 6838333: New I/O: Update file system API to jsr203/nio2-b101
alanb
parents: 2072
diff changeset
    30
import java.io.IOException;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    31
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    32
/**
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    33
 * An object to iterate over the entries in a directory. A directory stream
6537
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    34
 * allows for the convenient use of the for-each construct to iterate over a
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    35
 * directory.
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    36
 *
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    37
 * <p> <b> While {@code DirectoryStream} extends {@code Iterable}, it is not a
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    38
 * general-purpose {@code Iterable} as it supports only a single {@code
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    39
 * Iterator}; invoking the {@link #iterator iterator} method to obtain a second
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    40
 * or subsequent iterator throws {@code IllegalStateException}. </b>
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    41
 *
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    42
 * <p> An important property of the directory stream's {@code Iterator} is that
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    43
 * its {@link Iterator#hasNext() hasNext} method is guaranteed to read-ahead by
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    44
 * at least one element. If {@code hasNext} method returns {@code true}, and is
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    45
 * followed by a call to the {@code next} method, it is guaranteed that the
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    46
 * {@code next} method will not throw an exception due to an I/O error, or
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    47
 * because the stream has been {@link #close closed}. The {@code Iterator} does
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    48
 * not support the {@link Iterator#remove remove} operation.
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    49
 *
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    50
 * <p> A {@code DirectoryStream} is opened upon creation and is closed by
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    51
 * invoking the {@code close} method. Closing a directory stream releases any
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    52
 * resources associated with the stream. Failure to close the stream may result
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    53
 * in a resource leak. The try-with-resources statement provides a useful
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    54
 * construct to ensure that the stream is closed:
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    55
 * <pre>
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    56
 *   Path dir = ...
8158
77d9c0f1c19f 7006126: (fs) Updates to file system API (1/2011)
alanb
parents: 7668
diff changeset
    57
 *   try (DirectoryStream&lt;Path&gt; stream = Files.newDirectoryStream(dir)) {
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    58
 *       for (Path entry: stream) {
6537
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    59
 *           ...
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    60
 *       }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    61
 *   }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    62
 * </pre>
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    63
 *
6537
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    64
 * <p> Once a directory stream is closed, then further access to the directory,
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    65
 * using the {@code Iterator}, behaves as if the end of stream has been reached.
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    66
 * Due to read-ahead, the {@code Iterator} may return one or more elements
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    67
 * after the directory stream has been closed. Once these buffered elements
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    68
 * have been read, then subsequent calls to the {@code hasNext} method returns
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    69
 * {@code false}, and subsequent calls to the {@code next} method will throw
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    70
 * {@code NoSuchElementException}.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    71
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    72
 * <p> A directory stream is not required to be <i>asynchronously closeable</i>.
2072
80dfe4469bbd 6809132: (file) Javadoc style and consistency issues
alanb
parents: 2057
diff changeset
    73
 * If a thread is blocked on the directory stream's iterator reading from the
80dfe4469bbd 6809132: (file) Javadoc style and consistency issues
alanb
parents: 2057
diff changeset
    74
 * directory, and another thread invokes the {@code close} method, then the
80dfe4469bbd 6809132: (file) Javadoc style and consistency issues
alanb
parents: 2057
diff changeset
    75
 * second thread may block until the read operation is complete.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    76
 *
6537
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    77
 * <p> If an I/O error is encountered when accessing the directory then it
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    78
 * causes the {@code Iterator}'s {@code hasNext} or {@code next} methods to
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    79
 * throw {@link DirectoryIteratorException} with the {@link IOException} as the
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    80
 * cause. As stated above, the {@code hasNext} method is guaranteed to
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    81
 * read-ahead by at least one element. This means that if {@code hasNext} method
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    82
 * returns {@code true}, and is followed by a call to the {@code next} method,
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    83
 * then it is guaranteed that the {@code next} method will not fail with a
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    84
 * {@code DirectoryIteratorException}.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    85
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    86
 * <p> The elements returned by the iterator are in no specific order. Some file
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    87
 * systems maintain special links to the directory itself and the directory's
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    88
 * parent directory. Entries representing these links are not returned by the
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    89
 * iterator.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    90
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    91
 * <p> The iterator is <i>weakly consistent</i>. It is thread safe but does not
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    92
 * freeze the directory while iterating, so it may (or may not) reflect updates
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    93
 * to the directory that occur after the {@code DirectoryStream} is created.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    94
 *
6537
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    95
 * <p> <b>Usage Examples:</b>
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    96
 * Suppose we want a list of the source files in a directory. This example uses
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    97
 * both the for-each and try-with-resources constructs.
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    98
 * <pre>
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
    99
 *   List&lt;Path&gt; listSourceFiles(Path dir) throws IOException {
8158
77d9c0f1c19f 7006126: (fs) Updates to file system API (1/2011)
alanb
parents: 7668
diff changeset
   100
 *       List&lt;Path&gt; result = new ArrayList&lt;&gt;();
77d9c0f1c19f 7006126: (fs) Updates to file system API (1/2011)
alanb
parents: 7668
diff changeset
   101
 *       try (DirectoryStream&lt;Path&gt; stream = Files.newDirectoryStream(dir, "*.{c,h,cpp,hpp,java}")) {
6537
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   102
 *           for (Path entry: stream) {
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   103
 *               result.add(entry);
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   104
 *           }
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   105
 *       } catch (DirectoryIteratorException ex) {
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   106
 *           // I/O error encounted during the iteration, the cause is an IOException
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   107
 *           throw ex.getCause();
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   108
 *       }
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   109
 *       return result;
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   110
 *   }
7aa4e7bb5dae 6881498: (file) Re-examine DirectoryStream exception handling
alanb
parents: 5506
diff changeset
   111
 * </pre>
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   112
 * @param   <T>     The type of element returned by the iterator
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   113
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   114
 * @since 1.7
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   115
 *
8158
77d9c0f1c19f 7006126: (fs) Updates to file system API (1/2011)
alanb
parents: 7668
diff changeset
   116
 * @see Files#newDirectoryStream(Path)
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   117
 */
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   118
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   119
public interface DirectoryStream<T>
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   120
    extends Closeable, Iterable<T>
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   121
{
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   122
    /**
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   123
     * An interface that is implemented by objects that decide if a directory
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   124
     * entry should be accepted or filtered. A {@code Filter} is passed as the
8158
77d9c0f1c19f 7006126: (fs) Updates to file system API (1/2011)
alanb
parents: 7668
diff changeset
   125
     * parameter to the {@link Files#newDirectoryStream(Path,DirectoryStream.Filter)}
77d9c0f1c19f 7006126: (fs) Updates to file system API (1/2011)
alanb
parents: 7668
diff changeset
   126
     * method when opening a directory to iterate over the entries in the
77d9c0f1c19f 7006126: (fs) Updates to file system API (1/2011)
alanb
parents: 7668
diff changeset
   127
     * directory.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   128
     *
2072
80dfe4469bbd 6809132: (file) Javadoc style and consistency issues
alanb
parents: 2057
diff changeset
   129
     * @param   <T>     the type of the directory entry
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   130
     *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   131
     * @since 1.7
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   132
     */
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   133
    public static interface Filter<T> {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   134
        /**
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   135
         * Decides if the given directory entry should be accepted or filtered.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   136
         *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   137
         * @param   entry
2072
80dfe4469bbd 6809132: (file) Javadoc style and consistency issues
alanb
parents: 2057
diff changeset
   138
         *          the directory entry to be tested
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   139
         *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   140
         * @return  {@code true} if the directory entry should be accepted
3065
452aaa2899fc 6838333: New I/O: Update file system API to jsr203/nio2-b101
alanb
parents: 2072
diff changeset
   141
         *
452aaa2899fc 6838333: New I/O: Update file system API to jsr203/nio2-b101
alanb
parents: 2072
diff changeset
   142
         * @throws  IOException
452aaa2899fc 6838333: New I/O: Update file system API to jsr203/nio2-b101
alanb
parents: 2072
diff changeset
   143
         *          If an I/O error occurs
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   144
         */
3065
452aaa2899fc 6838333: New I/O: Update file system API to jsr203/nio2-b101
alanb
parents: 2072
diff changeset
   145
        boolean accept(T entry) throws IOException;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   146
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   147
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   148
    /**
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   149
     * Returns the iterator associated with this {@code DirectoryStream}.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   150
     *
2072
80dfe4469bbd 6809132: (file) Javadoc style and consistency issues
alanb
parents: 2057
diff changeset
   151
     * @return  the iterator associated with this {@code DirectoryStream}
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   152
     *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   153
     * @throws  IllegalStateException
2072
80dfe4469bbd 6809132: (file) Javadoc style and consistency issues
alanb
parents: 2057
diff changeset
   154
     *          if this directory stream is closed or the iterator has already
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   155
     *          been returned
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   156
     */
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   157
    @Override
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   158
    Iterator<T> iterator();
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   159
}