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.sdklib.io; 18 19 /** 20 * A folder. 21 */ 22 public interface IAbstractFolder extends IAbstractResource { 23 /** 24 * Instances of classes that implement this interface are used to 25 * filter filenames. 26 */ 27 public interface FilenameFilter { 28 /** 29 * Tests if a specified file should be included in a file list. 30 * 31 * @param dir the directory in which the file was found. 32 * @param name the name of the file. 33 * @return <code>true</code> if and only if the name should be 34 * included in the file list; <code>false</code> otherwise. 35 */ accept(IAbstractFolder dir, String name)36 boolean accept(IAbstractFolder dir, String name); 37 } 38 39 /** 40 * Returns true if the receiver contains a file with a given name 41 * @param name the name of the file. This is the name without the path leading to the 42 * parent folder. 43 */ hasFile(String name)44 boolean hasFile(String name); 45 46 /** 47 * returns an {@link IAbstractFile} representing a child of the current folder with the 48 * given name. The file may not actually exist. 49 * @param name the name of the file. 50 */ getFile(String name)51 IAbstractFile getFile(String name); 52 53 /** 54 * returns an {@link IAbstractFolder} representing a child of the current folder with the 55 * given name. The folder may not actually exist. 56 * @param name the name of the folder. 57 */ getFolder(String name)58 IAbstractFolder getFolder(String name); 59 60 /** 61 * returns a list of existing members in this folder. 62 */ listMembers()63 IAbstractResource[] listMembers(); 64 list(FilenameFilter filter)65 String[] list(FilenameFilter filter); 66 } 67