Class HexRecord


  • public class HexRecord
    extends java.lang.Object
    Class to encapsulate a hex record as used by Microchip tools.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int address  
      protected int addrh  
      protected int addrl  
      protected int checksum  
      protected byte[] data  
      (package private) static byte END  
      (package private) static byte EXT_ADDR  
      protected int len  
      protected int lineNo  
      (package private) static int MAX_LEN  
      protected int type  
      (package private) static byte TYPE_DATA  
      protected boolean valid  
    • Constructor Summary

      Constructors 
      Constructor Description
      HexRecord()
      Create an empty record with unprogrammed data and invalid status.
      HexRecord​(HexFile f)
      Read a new record from a file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int getAddress()
      Get current address from a hex record.
      protected byte[] getData()
      Get the data array from a hex record.
      protected byte getData​(int i)
      Get a data element from a hex record.
      (package private) void readData​(HexFile f)
      Read the data bytes.
      protected void setLineNo​(int l)
      Set the line number where the record was found in the file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HexRecord

        public HexRecord()
        Create an empty record with unprogrammed data and invalid status.
      • HexRecord

        public HexRecord​(HexFile f)
                  throws java.io.IOException
        Read a new record from a file.
        Parameters:
        f - hex file to read from
        Throws:
        java.io.IOException - from underlying read operations
    • Method Detail

      • setLineNo

        protected void setLineNo​(int l)
        Set the line number where the record was found in the file.
        Parameters:
        l - the line number
      • getData

        protected byte[] getData()
        Get the data array from a hex record.
        Returns:
        the data
      • getData

        protected byte getData​(int i)
        Get a data element from a hex record.
        Parameters:
        i - index of the element to get
        Returns:
        the data
      • getAddress

        protected int getAddress()
        Get current address from a hex record.

        Returns 16 bit address from a normal hex record. Extended address records are handled elsewhere.

        Returns:
        the address
      • readData

        void readData​(HexFile f)
               throws java.io.IOException
        Read the data bytes.
        Parameters:
        f - Input hex file
        Throws:
        java.io.IOException - from underlying read operations