clj-suomi.parsers.fixed-length-text
parser
(parser spec)
(parser spec {:keys [encoding], :or {encoding "UTF-8"}})
Create parser fn for parsing fixed length fields from strings.
Spec should be vector of tuples.
Spec tuples have two mandatory fields and third optional field.
- key: If truthy the read value will be added to the resulting map under this key.
- length: Length of the field in bytes.
- (optional) transform: Transformation function, takes in the read and trimmed string.
Options:
:encoding
- (optional) Encoding to be used when strings are converted to and from byte-arrays.