Autopsy  4.0
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  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 
61  @Override
62  public boolean accept(File f) {
63  if (f.isDirectory()) {
64  return true;
65  } else {
66  Boolean result = false;
67  String name = f.getName().toLowerCase();
68 
69  for (String ext : extensions) {
70  if (name.endsWith(ext)) {
71  result = result || true;
72  }
73  }
74  return result;
75  }
76  }
77 
83  @Override
84  public String getDescription() {
85  return desc;
86  }
87 
88 }
GeneralFilter(List< String > ext, String desc)
static final List< String > VIRTUAL_MACHINE_EXTS
static final List< String > ENCASE_IMAGE_EXTS

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.