fun extractFields(line: String?): Map<String, Any>? { if (!initialized) { init() initialized = true} val values: Array<String> = fixedWidthParser.parseLine(line) if (hasHeader && Arrays.deepEquals(values, header)) {return null } val map: MutableMap<String, Any> = Maps.newHashMap() var i = 0 for (field in fields) { map[field.getName()] = getValue(field, values[i++]) } return map }
Extracts the fields from a fixed width record and returns a map containing field names and values