1/* 2 * Copyright (C) 2011 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 17package vogar; 18 19import java.io.File; 20import java.io.FileFilter; 21 22/** 23 * Selects files to be kept from a test run. 24 */ 25public final class RetrievedFilesFilter implements FileFilter { 26 private final boolean profile; 27 private final File profileFile; 28 29 public RetrievedFilesFilter(boolean profile, File profileFile) { 30 this.profile = profile; 31 this.profileFile = profileFile; 32 } 33 34 @Override public boolean accept(File file) { 35 if (file.getName().equals("prefs.xml")) { 36 return false; 37 } 38 if (file.getName().endsWith(".xml") 39 || file.getName().equals("caliper-results") 40 || file.getName().endsWith(".json") 41 || (profile && file.getName().equals(profileFile.getName()))) { 42 return true; 43 } 44 return false; 45 } 46} 47