klyn.io.DirectoryReader.read
method
public read(maximum as Int = 256) as DirectoryBatch throws IOException
Description

Reads up to maximum directory entries (1..4096).

End-of-stream (batch.exhausted == true) is sticky across subsequent reads.

Parameters
ParameterDescription
maximumMaximum number of directory entries to inspect in this batch (1..4096).
Returns

Bounded batch of subdirectory names, optional file names and aggregate counts.

Throws
  • ValueException If maximum is outside 1..4096.
  • IOException If the reader is closed or the underlying OS enumeration fails.
Example
import klyn.io

try reader = Path.cwd.openReader():
    batch = reader.read(256)
    print(batch.folders.size)