Module jcifs

Class DirFileEntryEnumIteratorBase

java.lang.Object
org.codelibs.jcifs.smb.impl.DirFileEntryEnumIteratorBase
All Implemented Interfaces:
AutoCloseable, Iterator<FileEntry>, CloseableIterator<FileEntry>
Direct Known Subclasses:
DirFileEntryEnumIterator2

public abstract class DirFileEntryEnumIteratorBase extends Object implements CloseableIterator<FileEntry>
Base class for directory enumeration iterators. This abstract class provides common functionality for iterating over directory entries in SMB file shares.
Author:
mbechler
  • Constructor Details

    • DirFileEntryEnumIteratorBase

      public DirFileEntryEnumIteratorBase(org.codelibs.jcifs.smb.impl.SmbTreeHandleImpl th, SmbResource parent, String wildcard, ResourceNameFilter filter, int searchAttributes) throws CIFSException
      Creates a directory entry enumeration iterator.
      Parameters:
      th - the SMB tree handle for the connection
      parent - the parent resource being enumerated
      wildcard - the wildcard pattern for filtering entries
      filter - additional resource name filter to apply
      searchAttributes - the file attributes to search for
      Throws:
      CIFSException - if an error occurs during initialization
  • Method Details

    • getTreeHandle

      public final org.codelibs.jcifs.smb.impl.SmbTreeHandleImpl getTreeHandle()
      Gets the SMB tree handle for this iterator.
      Returns:
      the treeHandle
    • getSearchAttributes

      public final int getSearchAttributes()
      Gets the search attributes for this iterator.
      Returns:
      the search attributes used for filtering directory entries
    • getWildcard

      public final String getWildcard()
      Gets the wildcard pattern for this iterator.
      Returns:
      the wildcard
    • getParent

      public final SmbResource getParent()
      Gets the parent resource being enumerated.
      Returns:
      the parent
    • advance

      protected final FileEntry advance(boolean last) throws CIFSException
      Advances to the next file entry in the enumeration.
      Parameters:
      last - whether this is the last attempt to advance
      Returns:
      the next file entry, or null if no more entries
      Throws:
      CIFSException - if an error occurs during enumeration
    • open

      protected abstract FileEntry open() throws CIFSException
      Opens the enumeration and returns the first entry.
      Returns:
      the first file entry, or null if empty
      Throws:
      CIFSException - if an error occurs during opening
    • isDone

      protected abstract boolean isDone()
      Checks if the enumeration is complete.
      Returns:
      true if enumeration is done, false otherwise
    • fetchMore

      protected abstract boolean fetchMore() throws CIFSException
      Fetches more entries from the server.
      Returns:
      true if more entries were fetched, false otherwise
      Throws:
      CIFSException - if an error occurs during fetching
    • getResults

      protected abstract FileEntry[] getResults()
      Gets the current batch of results.
      Returns:
      array of file entries in the current batch
    • doClose

      protected void doClose() throws CIFSException
      Closes the enumeration and releases resources.
      Throws:
      CIFSException - if an error occurs during closing
    • doCloseInternal

      protected abstract void doCloseInternal() throws CIFSException
      Performs the internal closing operations specific to the implementation.
      Throws:
      CIFSException - if an error occurs during internal closing
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<FileEntry>
      See Also:
    • next

      public FileEntry next()
      Specified by:
      next in interface Iterator<FileEntry>
      See Also:
    • close

      public void close() throws CIFSException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface CloseableIterator<FileEntry>
      Throws:
      CIFSException
      See Also:
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<FileEntry>