Autopsy  4.17.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-2017 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 java.io.File;
22 import java.util.Arrays;
23 import java.util.List;
24 import javax.swing.filechooser.FileFilter;
25 import org.openide.util.NbBundle;
26 
30 public class GeneralFilter extends FileFilter {
31 
32  // Extensions & Descriptions for commonly used filters
33  public static final List<String> RAW_IMAGE_EXTS = Arrays.asList(".img", ".dd", ".001", ".aa", ".raw", ".bin"); //NON-NLS
34  @NbBundle.Messages("GeneralFilter.rawImageDesc.text=Raw Images (*.img, *.dd, *.001, *.aa, *.raw, *.bin)")
35  public static final String RAW_IMAGE_DESC = Bundle.GeneralFilter_rawImageDesc_text();
36 
37  public static final List<String> ENCASE_IMAGE_EXTS = Arrays.asList(".e01"); //NON-NLS
38  @NbBundle.Messages("GeneralFilter.encaseImageDesc.text=Encase Images (*.e01)")
39  public static final String ENCASE_IMAGE_DESC = Bundle.GeneralFilter_encaseImageDesc_text();
40 
41  public static final List<String> VIRTUAL_MACHINE_EXTS = Arrays.asList(".vmdk", ".vhd"); //NON-NLS
42  @NbBundle.Messages("GeneralFilter.virtualMachineImageDesc.text=Virtual Machines (*.vmdk, *.vhd)")
43  public static final String VIRTUAL_MACHINE_DESC = Bundle.GeneralFilter_virtualMachineImageDesc_text();
44 
45  public static final List<String> EXECUTABLE_EXTS = Arrays.asList(".exe"); //NON-NLS
46  @NbBundle.Messages("GeneralFilter.executableDesc.text=Executables (*.exe)")
47  public static final String EXECUTABLE_DESC = Bundle.GeneralFilter_executableDesc_text();
48 
49  public static final List<String> GRAPHIC_IMAGE_EXTS = Arrays.asList(".png", ".jpeg", ".jpg", ".gif", ".bmp"); //NON-NLS
50  @NbBundle.Messages("GeneralFilter.graphicImageDesc.text=Images (*.png, *.jpg, *.jpeg, *.gif, *.bmp)")
51  public static final String GRAPHIC_IMG_DECR = Bundle.GeneralFilter_graphicImageDesc_text();
52 
53  private final List<String> extensions;
54  private final String desc;
55 
56  public GeneralFilter(List<String> ext, String desc) {
57  super();
58  this.extensions = ext;
59  this.desc = desc;
60  }
61 
69  @Override
70  public boolean accept(File f) {
71  if (f.isDirectory()) {
72  return true;
73  } else {
74  String name = f.getName().toLowerCase();
75  return extensions.stream().anyMatch(name::endsWith);
76  }
77  }
78 
84  @Override
85  public String getDescription() {
86  return desc;
87  }
88 }
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-2021 Basis Technology. Generated on: Tue Jan 19 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.