Autopsy  4.4
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  public static final List<String> GRAPHIC_IMAGE_EXTS = Arrays.asList(new String[]{".png", ".jpeg", ".jpg", ".gif", ".bmp"}); //NON-NLS
49  public static final String GRAPHIC_IMG_DECR = NbBundle.getMessage(GeneralFilter.class, "GeneralFilter.graphicImageDesc.text");
50 
51  private List<String> extensions;
52  private String desc;
53 
54  public GeneralFilter(List<String> ext, String desc) {
55  super();
56  this.extensions = ext;
57  this.desc = desc;
58  }
59 
67  @Override
68  public boolean accept(File f) {
69  if (f.isDirectory()) {
70  return true;
71  } else {
72  Boolean result = false;
73  String name = f.getName().toLowerCase();
74 
75  for (String ext : extensions) {
76  if (name.endsWith(ext)) {
77  result = result || true;
78  }
79  }
80  return result;
81  }
82  }
83 
89  @Override
90  public String getDescription() {
91  return desc;
92  }
93 
94 }
GeneralFilter(List< String > ext, String desc)
static final List< String > GRAPHIC_IMAGE_EXTS
static final List< String > VIRTUAL_MACHINE_EXTS
static final List< String > ENCASE_IMAGE_EXTS

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