Debian Codegraph @

common/src/main/java/com/android/io/IAbstractFolder.java

raw
1 /*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.android.io;
18
19 import java.io.File;
20
21 /**
22 * A folder.
23 */
24 public interface IAbstractFolder extends IAbstractResource {
25 /**
26 * Instances of classes that implement this interface are used to
27 * filter filenames.
28 */
29 interface FilenameFilter {
30 /**
31 * Tests if a specified file should be included in a file list.
32 *
33 * @param dir the directory in which the file was found.
34 * @param name the name of the file.
35 * @return <code>true</code> if and only if the name should be
36 * included in the file list; <code>false</code> otherwise.
37 */
38 boolean accept(IAbstractFolder dir, String name);
39 }
40
41 /**
42 * Returns true if the receiver contains a file with a given name
43 * @param name the name of the file. This is the name without the path leading to the
44 * parent folder.
45 */
46 boolean hasFile(String name);
47
48 /**
49 * Returns an {@link IAbstractFile} representing a child of the current folder with the
50 * given name. The file may not actually exist.
51 * @param name the name of the file.
52 */
53 IAbstractFile getFile(String name);
54
55 /**
56 * Returns an {@link IAbstractFolder} representing a child of the current folder with the
57 * given name. The folder may not actually exist.
58 * @param name the name of the folder.
59 */
60 IAbstractFolder getFolder(String name);
61
62 /**
63 * Returns a list of all existing file and directory members in this folder.
64 * The returned array can be empty but is never null.
65 */
66 IAbstractResource[] listMembers();
67
68 /**
69 * Returns a list of all existing file and directory members in this folder
70 * that satisfy the specified filter.
71 *
72 * @param filter A filename filter instance. Must not be null.
73 * @return An array of file names (generated using {@link File#getName()}).
74 * The array can be empty but is never null.
75 */
76 String[] list(FilenameFilter filter);
77 }