module

Chem::FormatReader::Indexable(T)

Inherits Chem::FormatReader::MultiEntry

Declares a common interface for indexed reading of a finite number of objects encoded in a file format.

Including types must implement methods to track and set the current object in the IO.

Instance methods

entry_index

Returns the index of the current entry.

Source
n_entries

Returns the number of entries in the IO.

Source
next_entry

Returns the next entry in the IO, or nil if there are no more entries.

Source
read_entry(index : Int) : T

Returns the entry at the given index. Raises IndexError if the index is invalid.

Source
skip_entry

Discards the next entry in the IO without fully parsing it.

Source
skip_to_entry(index : Int) : Nil

Discards the entries (without parsing) up until the given index. Raises IndexError if the index is invalid.

Source