Module jcifs

Class DosFileFilter

java.lang.Object
org.codelibs.jcifs.smb.impl.DosFileFilter
All Implemented Interfaces:
SmbFileFilter

public class DosFileFilter extends Object implements SmbFileFilter
File filter implementation for DOS-style wildcards and attributes. Supports filtering files based on DOS wildcards and file attributes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The DOS file attributes to filter on.
    protected String
    The wildcard pattern for filtering file names.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DosFileFilter(String wildcard, int attributes)
    This filter can be considerably more efficient than other file filters as the specified wildcard and attributes are passed to the server for filtering there (although attributes are largely ignored by servers they are filtered locally by the default accept method).
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This returns true if the file's attributes contain any of the attributes specified for this filter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • wildcard

      protected String wildcard
      The wildcard pattern for filtering file names.
    • attributes

      protected int attributes
      The DOS file attributes to filter on.
  • Constructor Details

    • DosFileFilter

      public DosFileFilter(String wildcard, int attributes)
      This filter can be considerably more efficient than other file filters as the specified wildcard and attributes are passed to the server for filtering there (although attributes are largely ignored by servers they are filtered locally by the default accept method).
      Parameters:
      wildcard - the wildcard pattern for matching file names (e.g., "*.txt")
      attributes - the DOS file attributes to match (e.g., ATTR_DIRECTORY)
  • Method Details

    • accept

      public boolean accept(SmbFile file) throws SmbException
      This returns true if the file's attributes contain any of the attributes specified for this filter. The wildcard has no influence on this method as the server should have performed that filtering already. The attributes are asserted here only because server file systems may not support filtering by all attributes (e.g. even though ATTR_DIRECTORY was specified the server may still return objects that are not directories).
      Specified by:
      accept in interface SmbFileFilter
      Parameters:
      file - the SMB file to test for inclusion
      Returns:
      whether the given file should be included
      Throws:
      SmbException - if an error occurs while accessing the file