public class ExtensionFileFilter extends java.lang.Object implements FileFilter
Constructor and Description |
---|
ExtensionFileFilter(java.lang.String[] extns,
java.lang.String description)
Create a filter which accepts files based on their extension.
|
ExtensionFileFilter(java.lang.String extn,
java.lang.String description)
Create a filter which accepts files based on their extension.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File f)
Check if a file is accepted by this filter.
|
boolean |
acceptsDirectories()
Check if (all) directories are accepted by this filter.
|
java.io.File |
ensureExtension(java.io.File file)
Ensure that a filename ends with one of the extensions accepted
by this filter.
|
java.lang.String |
ensureExtension(java.lang.String path)
Ensure that a pathname ends with one of the extensions accepted
by this filter.
|
java.lang.String |
getDescription()
Get a short description for this filter.
|
boolean |
isCaseSensitive()
Check whether or not this filter should perform case-sensitive matching for
extensions.
|
void |
setCaseSensitive(boolean b)
Specify whether or not this filter should perform case-sensitive matching for
extensions.
|
public ExtensionFileFilter(java.lang.String extn, java.lang.String description)
extn
- The required extension for files that are to be
accepted by this filter.description
- A short string describing the filter.public ExtensionFileFilter(java.lang.String[] extns, java.lang.String description)
extns
- Any array of permissible extensions for
files that are to be accepted by this filter.description
- A short string describing the filter.public void setCaseSensitive(boolean b)
b
- true if this filter should perform case-sensitive matching for
extensions, and false otherwiseisCaseSensitive()
public boolean isCaseSensitive()
setCaseSensitive(boolean)
public boolean accept(java.io.File f)
FileFilter
accept
in interface FileFilter
f
- The file to be tested.public boolean acceptsDirectories()
FileFilter
acceptsDirectories
in interface FileFilter
public java.lang.String getDescription()
getDescription
in interface FileFilter
public java.lang.String ensureExtension(java.lang.String path)
path
- The path to be checked.public java.io.File ensureExtension(java.io.File file)
file
- The file to be checked.Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.