Package ghidra.app.util.bin.format.omf

# Class OmfRecord

java.lang.Object
ghidra.app.util.bin.format.omf.OmfRecord

All Implemented Interfaces:
  `StructConverter`

Direct Known Subclasses:
  `Omf166DepList`, `Omf51Content`, `Omf51ExternalDefsRecord`, `Omf51FixupRecord`, `Omf51LibraryDictionaryRecord`, `Omf51LibraryHeaderRecord`, `Omf51LibraryModuleLocationsRecord`, `Omf51LibraryModuleNamesRecord`, `Omf51ModuleEnd`, `Omf51ModuleHeader`, `Omf51PublicDefsRecord`, `Omf51SegmentDefs`, `OmfCommentRecord`, `OmfData`, `OmfExternalSymbol`, `OmfFileHeader`, `OmfFixupRecord`, `OmfGroupRecord`, `OmfModuleEnd`, `OmfNamesRecord`, `OmfObsoleteRecord`, `OmfSegmentHeader`, `OmfSymbolRecord`, `OmfUnknownRecord`, `OmfUnsupportedRecord`

public abstract class OmfRecord extends Object implements StructConverter
A generic OMF record

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected byte`
  `checkSum`
  `protected byte[]`
  `data`
  `protected long`
  `dataEnd`
  `protected BinaryReader`
  `dataReader`
  `protected int`
  `recordLength`
  `protected long`
  `recordOffset`
  `protected int`
  `recordType`

  ### Fields inherited from interface ghidra.app.util.bin.StructConverter

  `ASCII, BYTE, DWORD, IBO32, IBO64, POINTER, QWORD, SLEB128, STRING, ULEB128, UTF16, UTF8, VOID, WORD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OmfRecord()`
  `OmfRecord(BinaryReader reader)`
  Creates a new `OmfRecord`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte`
  `calcCheckSum()`
  Computes the record's checksum
  `byte[]`
  `getData()`
  Returns the record data.
  `byte`
  `getRecordChecksum()`
  Returns the record checksum.
  `int`
  `getRecordLength()`
  Returns the record length.
  `long`
  `getRecordOffset()`
  Returns the record offset.
  `int`
  `getRecordType()`
  Returns the record type.
  `boolean`
  `hasBigFields()`
  Returns true if this record has big fields; otherwise, false.
  `abstract void`
  `parseData()`
  Parses this `OmfRecord`'s type-spefic data
  `abstract DataType`
  `toDataType()`
  Returns a structure datatype representing the contents of the implementor of this interface.
  `String`
  `toString()`
  `boolean`
  `validCheckSum()`
  Validates the record's checksum

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### recordType

    protected int recordType

  - ### recordLength

    protected int recordLength

  - ### data

    protected byte[] data

  - ### checkSum

    protected byte checkSum

  - ### recordOffset

    protected long recordOffset

  - ### dataReader

    protected BinaryReader dataReader

  - ### dataEnd

    protected long dataEnd

- ## Constructor Details

  - ### OmfRecord

    public OmfRecord()

  - ### OmfRecord

    public OmfRecord(BinaryReader reader) throws IOException
    Creates a new `OmfRecord`
    Parameters:
      `reader` - A `BinaryReader` positioned at the start of the record
    Throws:
      `IOException` - if there was an IO-related error

- ## Method Details

  - ### parseData

    public abstract void parseData() throws IOException, OmfException
    Parses this `OmfRecord`'s type-spefic data
    Throws:
      `IOException` - if there was an IO-related error
      `OmfException` - if there was a problem with the OMF specification

  - ### toDataType

    public abstract DataType toDataType() throws DuplicateNameException, IOException
    Description copied from interface: `StructConverter`
    Returns a structure datatype representing the contents of the implementor of this interface.

    For example, given:

         class A {
             int foo;
             double bar;
         }

    The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.

    Specified by:
      `toDataType` in interface `StructConverter`
    Returns:
      returns a structure datatype representing the implementor of this interface
    Throws:
      `DuplicateNameException` - when a datatype of the same name already exists
      `IOException` - if an IO-related error occurs
    See Also:
      - `StructureDataType`

  - ### getRecordType

    public int getRecordType()
    Returns the record type.
    Returns:
      the record type

  - ### getRecordLength

    public int getRecordLength()
    Returns the record length.
    Returns:
      the record length

  - ### getRecordOffset

    public long getRecordOffset()
    Returns the record offset.
    Returns:
      the record offset

  - ### getRecordChecksum

    public byte getRecordChecksum()
    Returns the record checksum.
    Returns:
      the record checksum

  - ### getData

    public byte[] getData()
    Returns the record data.
    Returns:
      the record data

  - ### calcCheckSum

    public byte calcCheckSum() throws IOException
    Computes the record's checksum
    Returns:
      The record's checksum
    Throws:
      `IOException` - if an IO-related error occurred

  - ### validCheckSum

    public boolean validCheckSum() throws IOException
    Validates the record's checksum
    Returns:
      True if the checksum is valid; otherwise, false
    Throws:
      `IOException` - if an IO-related error occurred

  - ### hasBigFields

    public boolean hasBigFields()
    Returns true if this record has big fields; otherwise, false.
    Returns:
      true if this record has big fields; otherwise, false

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`