Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
GeneralFilter.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 package org.sleuthkit.autopsy.casemodule;
21 
22 import org.openide.util.NbBundle;
23 
24 import java.io.File;
25 import java.util.List;
26 import java.util.Arrays;
27 import javax.swing.filechooser.FileFilter;
28 
32 public class GeneralFilter extends FileFilter{
33 
34 
35  // Extensions & Descriptions for commonly used filters
36  public static final List<String> RAW_IMAGE_EXTS = Arrays.asList(new String[]{".img", ".dd", ".001", ".aa", ".raw", ".bin"}); //NON-NLS
37  public static final String RAW_IMAGE_DESC = NbBundle.getMessage(GeneralFilter.class, "GeneralFilter.rawImageDesc.text");
38 
39  public static final List<String> ENCASE_IMAGE_EXTS = Arrays.asList(new String[]{".e01"}); //NON-NLS
40  public static final String ENCASE_IMAGE_DESC = NbBundle.getMessage(GeneralFilter.class,
41  "GeneralFilter.encaseImageDesc.text");
42 
43 
44 
45  private List<String> extensions;
46  private String desc;
47 
48  public GeneralFilter(List<String> ext, String desc){
49  super();
50  this.extensions = ext;
51  this.desc = desc;
52  }
53 
60  @Override
61  public boolean accept(File f) {
62  if(f.isDirectory()){
63  return true;
64  } else {
65  Boolean result = false;
66  String name = f.getName().toLowerCase();
67 
68  for (String ext : extensions) {
69  if (name.endsWith(ext)) {
70  result = result || true;
71  }
72  }
73  return result;
74  }
75  }
76 
82  @Override
83  public String getDescription() {
84  return desc;
85  }
86 
87 }
GeneralFilter(List< String > ext, String desc)

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.