public class DirectoryReader implements AutoClosable
Streaming directory enumeration cursor.
Reads a directory in bounded batches without materializing the entire directory listing at once or populating global path-type caches. On Windows, directory enumeration supplies entry types and file sizes directly; on POSIX, directory entry types (d_type) classify subdirectories and regular files without extra system calls unless includeFileBytes or followSymlinks requires metadata resolution.
Always close the reader when finished, preferably with try reader = folder.openReader():.
import klyn.io
try reader = Path.cwd.openReader():
exhausted = false
while not exhausted:
batch = reader.read(256)
for name in batch.fileNames:
print(name)
exhausted = batch.exhausted| Modifier and Type | Member | Description |
|---|---|---|
| public | DirectoryReaderDirectoryReader(
folder as FolderPath,
includeFileNames as Boolean = true,
includeFileBytes as Boolean = false,
followSymlinks as Boolean = false
) throws IOException |
Opens a streaming cursor on a directory. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | closeclose() as Void |
Releases the underlying OS directory handle. |
| public | readread(maximum as Int = 256) as DirectoryBatch throws IOException |
Reads up to maximum directory entries (1..4096). |