hashcode-utils-kt / org.hildan.hashcode.utils.reader / withHCReader

withHCReader

inline fun <P> withHCReader(input: String, tokenDelimiter: Regex = DEFAULT_HASHCODE_INPUT_DELIMITER, readProblem: HCReader.() -> P): P

Executes the given readProblem function on a new HCReader, reading the given input text. The reader is closed whether an exception is thrown or not.

inline fun <P> withHCReader(path: Path, tokenDelimiter: Regex = DEFAULT_HASHCODE_INPUT_DELIMITER, readProblem: HCReader.() -> P): P

Executes the given readProblem function on a new HCReader, reading the file at the given path. The reader is closed whether an exception is thrown or not.