private Object processElement()

in src/main/java/com/epam/parso/impl/SasFileParser.java [886:925]


    private Object processElement(byte[] source, int offset, int currentColumnIndex) {
        byte[] temp;
        int length = columnsDataLength.get(currentColumnIndex);
        if (columns.get(currentColumnIndex).getType() == Number.class) {
            temp = Arrays.copyOfRange(source, offset + (int) (long) columnsDataOffset.get(currentColumnIndex),
                    offset + (int) (long) columnsDataOffset.get(currentColumnIndex) + length);
            if (columnsDataLength.get(currentColumnIndex) <= 2) {
                return bytesToShort(temp);
            } else {
                if (columns.get(currentColumnIndex).getFormat().getName().isEmpty()) {
                    return convertByteArrayToNumber(temp);
                } else {
                    ColumnFormat columnFormat = columns.get(currentColumnIndex).getFormat();
                    String sasDateFormat = columnFormat.getName();
                    if (SasTemporalFormatter.isDateTimeFormat(sasDateFormat)) {
                        return bytesToDateTime(temp, outputDateType, columnFormat);
                    } else if (SasTemporalFormatter.isDateFormat(sasDateFormat)) {
                        return bytesToDate(temp, outputDateType, columnFormat);
                    } else if (SasTemporalFormatter.isTimeFormat(sasDateFormat)) {
                        return bytesToTime(temp, outputDateType, columnFormat);
                    } else {
                        return convertByteArrayToNumber(temp);
                    }
                }
            }
        } else {
            byte[] bytes = trimBytesArray(source,
                    offset + columnsDataOffset.get(currentColumnIndex).intValue(), length);
            if (byteOutput) {
                return bytes;
            } else {
                try {
                    return (bytes == null ? null : bytesToString(bytes));
                } catch (UnsupportedEncodingException e) {
                    LOGGER.error(e.getMessage(), e);
                }
            }
        }
        return null;
    }