public class DefaultFileFilter extends FileFilter
Constructor and Description |
---|
DefaultFileFilter()
Creates a file filter.
|
DefaultFileFilter(String extension)
Creates a file filter that accepts files with the given extension.
|
DefaultFileFilter(String[] filters)
Creates a file filter from the given string array.
|
DefaultFileFilter(String[] filters,
String description)
Creates a file filter from the given string array and description.
|
DefaultFileFilter(String extension,
String description)
Creates a file filter that accepts the given file type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(File f)
Return true if this file should be shown in the directory pane, false if
it shouldn't.
|
void |
addExtension(String extension)
Adds a filetype "dot" extension to filter against.
|
String |
getDescription()
Returns the human readable description of this filter.
|
String |
getExtension(File f)
Return the extension portion of the file's name.
|
static FileFilter |
getFileFilter()
Returns a file filter for HDF4/5 file.
|
static FileFilter |
getFileFilterBinary()
Returns a file filter for binary files.
|
static FileFilter |
getFileFilterBMP()
Returns a file filter for BMP image files.
|
static FileFilter |
getFileFilterGIF()
Returns a file filter for GIF image files.
|
static FileFilter |
getFileFilterHDF4()
Returns a file filter for HDF4 file.
|
static FileFilter |
getFileFilterHDF5()
Returns a file filter for HDF5 file.
|
static FileFilter |
getFileFilterJPEG()
Returns a file filter for JPEG image files.
|
static FileFilter |
getFileFilterPNG()
Returns a file filter for PNG image files.
|
static FileFilter |
getFileFilterText()
Returns a file filter for text files.
|
static FileFilter |
getFileFilterTIFF()
Returns a file filter for TIFF image files.
|
static byte[] |
getHDF5UserBlock(String filename)
Read HDF5 user block data into byte array.
|
static FileFilter |
getImageFileFilter()
Returns a file filter for GIF, JPEG, BMP, or PNG image files.
|
boolean |
isExtensionListInDescription()
Returns whether the extension list (.jpg, .gif, etc) should show up in
the human readable description.
|
static boolean |
isHDF4(String filename)
look at the first 4 bytes of the file to see if it is an HDF4 file.
|
static boolean |
isHDF5(String filename)
look at the first 8 bytes of the file to see if it is an HDF5 file.
|
static boolean |
isNetcdf(String filename)
look at the first 4 bytes of the file to see if it is a netCDF file
byte[0]=67, byte[1]=68, byte[2]=70, byte[3]=1 or
|
void |
setDescription(String description)
Sets the human readable description of this filter.
|
void |
setExtensionListInDescription(boolean b)
Determines whether the extension list (.jpg, .gif, etc) should show up in
the human readable description.
|
static boolean |
setHDF5UserBlock(String fin,
String fout,
byte[] buf)
Write HDF5 user block data into byte array.
|
public DefaultFileFilter()
addExtension(java.lang.String)
public DefaultFileFilter(String extension)
extension
- The extension for this FileFilter to filter byaddExtension(java.lang.String)
public DefaultFileFilter(String extension, String description)
extension
- The extension for this FileFilter to filter bydescription
- The human readable description of this FileFilteraddExtension(java.lang.String)
public DefaultFileFilter(String[] filters)
filters
- The array of extensions for this FileFilter to filter byaddExtension(java.lang.String)
public DefaultFileFilter(String[] filters, String description)
filters
- The array of extensions for this FileFilter to filter bydescription
- The human readable description of this FileFilteraddExtension(java.lang.String)
public boolean accept(File f)
accept
in class FileFilter
getExtension(java.io.File)
public String getExtension(File f)
f
- The file to get the extension portion of the name forgetExtension(java.io.File)
,
FileFilter.accept(java.io.File)
public void addExtension(String extension)
extension
- The "dot" extension to addpublic String getDescription()
getDescription
in class FileFilter
public void setDescription(String description)
description
- The human readable description to set for this filterpublic void setExtensionListInDescription(boolean b)
b
- Sets extension list to show up in the human readable description
if true; list doesn't show up otherwisepublic boolean isExtensionListInDescription()
public static FileFilter getFileFilter()
public static FileFilter getFileFilterHDF4()
public static FileFilter getFileFilterHDF5()
public static FileFilter getFileFilterJPEG()
public static FileFilter getFileFilterTIFF()
public static FileFilter getFileFilterPNG()
public static FileFilter getFileFilterBMP()
public static FileFilter getFileFilterGIF()
public static FileFilter getImageFileFilter()
public static FileFilter getFileFilterText()
public static FileFilter getFileFilterBinary()
public static boolean isHDF4(String filename)
filename
- The name of the file to checkpublic static boolean isHDF5(String filename)
filename
- The name of the file to checkpublic static boolean isNetcdf(String filename)
filename
- The name of the file to checkpublic static byte[] getHDF5UserBlock(String filename)
filename
- The name of the file to read the HDF5 user block frompublic static boolean setHDF5UserBlock(String fin, String fout, byte[] buf)
fin
- The name of the file to copy to the output filefout
- The name of the file to write HDF5 user block data tobuf
- The HDF5 user block data to write into the output fileCopyright ? 2016. All Rights Reserved.