Search this API

y.io
Class SuffixFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by y.io.SuffixFileFilter

public class SuffixFileFilter
extends javax.swing.filechooser.FileFilter

A file filter that accepts file names with a specific suffix.

 

Constructor Summary
SuffixFileFilter(java.lang.String acceptingSuffix, java.lang.String description)
          Creates a new instance of YFileFilter.
SuffixFileFilter(java.lang.String acceptingSuffix, java.lang.String description, boolean acceptDir)
          Creates a new instance of YFileFilter.
 
Method Summary
 boolean accept(java.io.File f)
          Returns true iff the specified File does not represent a directory and its filename extension matches this SuffixFileFilter's accepting suffix or the accepting suffix' length is 0.
 boolean equals(java.lang.Object o)
           
 java.lang.String getAcceptingSuffix()
          Returns the filename suffix that determines which files are accepted.
 java.lang.String getDescription()
          Returns the description for this SuffixFileFilter.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SuffixFileFilter

public SuffixFileFilter(java.lang.String acceptingSuffix,
                        java.lang.String description)
Creates a new instance of YFileFilter. It accepts files and directories by default.

Parameters:
acceptingSuffix - the suffix string for accepted file names.
description - a descriptive String for the accepted file format

SuffixFileFilter

public SuffixFileFilter(java.lang.String acceptingSuffix,
                        java.lang.String description,
                        boolean acceptDir)
Creates a new instance of YFileFilter.

Parameters:
acceptingSuffix - the suffix string for accepted file names.
description - a descriptive String for the accepted file format
acceptDir - whether or not this filter accepts directories
Method Detail

accept

public boolean accept(java.io.File f)
Returns true iff the specified File does not represent a directory and its filename extension matches this SuffixFileFilter's accepting suffix or the accepting suffix' length is 0.

Specified by:
accept in class javax.swing.filechooser.FileFilter
Parameters:
f - the File to check
Returns:
true iff the specified File does not represent a directory and its filename extension matches this SuffixFileFilter's accepting suffix or the accepting suffix' length is 0.

getAcceptingSuffix

public java.lang.String getAcceptingSuffix()
Returns the filename suffix that determines which files are accepted.

Returns:
the filename suffix that determines which files are accepted.

getDescription

public java.lang.String getDescription()
Returns the description for this SuffixFileFilter.

Specified by:
getDescription in class javax.swing.filechooser.FileFilter
Returns:
the description for this SuffixFileFilter.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.