Autopsy  4.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 package org.sleuthkit.autopsy.casemodule;
20 
21 import org.openide.util.NbBundle;
22 
23 import java.io.File;
24 import java.util.List;
25 import java.util.Arrays;
26 import javax.swing.filechooser.FileFilter;
27 
31 public class GeneralFilter extends FileFilter {
32 
33  // Extensions & Descriptions for commonly used filters
34  public static final List<String> RAW_IMAGE_EXTS = Arrays.asList(new String[]{".img", ".dd", ".001", ".aa", ".raw", ".bin"}); //NON-NLS
35  public static final String RAW_IMAGE_DESC = NbBundle.getMessage(GeneralFilter.class, "GeneralFilter.rawImageDesc.text");
36 
37  public static final List<String> ENCASE_IMAGE_EXTS = Arrays.asList(new String[]{".e01"}); //NON-NLS
38  public static final String ENCASE_IMAGE_DESC = NbBundle.getMessage(GeneralFilter.class,
39  "GeneralFilter.encaseImageDesc.text");
40 
41  public static final List<String> VIRTUAL_MACHINE_EXTS = Arrays.asList(new String[]{".vmdk", ".vhd"}); //NON-NLS
42  public static final String VIRTUAL_MACHINE_DESC = NbBundle.getMessage(GeneralFilter.class,
43  "GeneralFilter.virtualMachineImageDesc.text");
44 
45  public static final List<String> EXECUTABLE_EXTS = Arrays.asList(new String[]{".exe"}); //NON-NLS
46  public static final String EXECUTABLE_DESC = NbBundle.getMessage(GeneralFilter.class, "GeneralFilter.executableDesc.text");
47 
48  private List<String> extensions;
49  private String desc;
50 
51  public GeneralFilter(List<String> ext, String desc) {
52  super();
53  this.extensions = ext;
54  this.desc = desc;
55  }
56 
64  @Override
65  public boolean accept(File f) {
66  if (f.isDirectory()) {
67  return true;
68  } else {
69  Boolean result = false;
70  String name = f.getName().toLowerCase();
71 
72  for (String ext : extensions) {
73  if (name.endsWith(ext)) {
74  result = result || true;
75  }
76  }
77  return result;
78  }
79  }
80 
86  @Override
87  public String getDescription() {
88  return desc;
89  }
90 
91 }
GeneralFilter(List< String > ext, String desc)
static final List< String > VIRTUAL_MACHINE_EXTS
static final List< String > ENCASE_IMAGE_EXTS

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