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 Summary
ConstructorsConstructorDescriptionDirFileEntryEnumIteratorBase(org.codelibs.jcifs.smb.impl.SmbTreeHandleImpl th, SmbResource parent, String wildcard, ResourceNameFilter filter, int searchAttributes) Creates a directory entry enumeration iterator. -
Method Summary
Modifier and TypeMethodDescriptionprotected final FileEntryadvance(boolean last) Advances to the next file entry in the enumeration.voidclose()protected voiddoClose()Closes the enumeration and releases resources.protected abstract voidPerforms the internal closing operations specific to the implementation.protected abstract booleanFetches more entries from the server.final SmbResourceGets the parent resource being enumerated.protected abstract FileEntry[]Gets the current batch of results.final intGets the search attributes for this iterator.final org.codelibs.jcifs.smb.impl.SmbTreeHandleImplGets the SMB tree handle for this iterator.final StringGets the wildcard pattern for this iterator.booleanhasNext()protected abstract booleanisDone()Checks if the enumeration is complete.next()protected abstract FileEntryopen()Opens the enumeration and returns the first entry.voidremove()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
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 connectionparent- the parent resource being enumeratedwildcard- the wildcard pattern for filtering entriesfilter- additional resource name filter to applysearchAttributes- 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
Gets the wildcard pattern for this iterator.- Returns:
- the wildcard
-
getParent
Gets the parent resource being enumerated.- Returns:
- the parent
-
advance
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
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
Fetches more entries from the server.- Returns:
- true if more entries were fetched, false otherwise
- Throws:
CIFSException- if an error occurs during fetching
-
getResults
Gets the current batch of results.- Returns:
- array of file entries in the current batch
-
doClose
Closes the enumeration and releases resources.- Throws:
CIFSException- if an error occurs during closing
-
doCloseInternal
Performs the internal closing operations specific to the implementation.- Throws:
CIFSException- if an error occurs during internal closing
-
hasNext
public boolean hasNext() -
next
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseableIterator<FileEntry>- Throws:
CIFSException- See Also:
-
remove
public void remove()
-