private void checkRecordType() {
		switch (getRecordType()) {
			case DATA_RECORD_TYPE:
				// valid, no real restrictions
				break;
			case END_OF_FILE_RECORD_TYPE:
				if (getRecordLength() != 0) {
					throw new IllegalArgumentException("bad length (" + getRecordLength() +
						") for End Of File Record");
				}
				if (getLoadOffset() != 0) {
					throw new IllegalArgumentException("bad load offset (" + getLoadOffset() +
						") for End Of File Record");
				}
				break;
			case EXTENDED_SEGMENT_ADDRESS_RECORD_TYPE:
				if (getRecordLength() != 2) {
					throw new IllegalArgumentException("bad length (" + getRecordLength() +
						") for Extended Segment Address Record");
				}
				if (getLoadOffset() != 0) {
					throw new IllegalArgumentException("bad load offset (" + getLoadOffset() +
						") for Extended Segment Address Record");
				}
				break;
			case START_SEGMENT_ADDRESS_RECORD:
				if (getRecordLength() != 4) {
					throw new IllegalArgumentException("bad length (" + getRecordLength() +
						") for Start Segment Address Record");
				}
				if (getLoadOffset() != 0) {
					throw new IllegalArgumentException("bad load offset (" + getLoadOffset() +
						") for Start Segment Address Record");
				}
				break;
			case EXTENDED_LINEAR_ADDRESS_RECORD_TYPE:
				if (getRecordLength() != 2) {
					throw new IllegalArgumentException("bad length (" + getRecordLength() +
						") for Extended Linear Address Record");
				}
				if (getLoadOffset() != 0) {
					throw new IllegalArgumentException("bad load offset (" + getLoadOffset() +
						") for Extended Linear Address Record");
				}
				break;
			case START_LINEAR_ADDRESS_RECORD_TYPE:
				if (getRecordLength() != 4) {
					throw new IllegalArgumentException("bad length (" + getRecordLength() +
						") for Start Linear Address Record");
				}
				if (getLoadOffset() != 0) {
					throw new IllegalArgumentException("bad load offset (" + getLoadOffset() +
						") for Start Linear Address Record");
				}
				break;
			default:
				throw new IllegalArgumentException("illegal record type - " + getRecordType());
		}
	}
Only use this constructor when writing...it computes the checksum for you (cheating)!
@param recordLength
@param loadOffset
@param recordType
@param data
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/IntelHexRecord.java