Interface DataBuffer


  • public interface DataBuffer
    DataBuffer provides an array like interface into a set of Data at a specific index. Data can be retrieved by using a positive offset from the current position. The purpose of this class is to provide an opaque storage mechanism for Data that is made up of other Data items. This interface does not provide methods to reposition the data item buffer. This is so that it is clear that methods accepeting this base class are not to mess which the base Address for this object.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Address getAddress()
      Get the Address which corresponds to the offset 0.
      Data getData​(int offset)
      Get one Data item from the buffer at the current position plus offset.
      Data[] getData​(int start, int end)
      Get an array of data items that begin at or after start up to end.
      Data getDataAfter​(int offset)
      Get the next data item starting after offset.
      Data getDataBefore​(int offset)
      Get the previous data item starting before offset.
      int getNextOffset​(int offset)
      Get the offset to the next data item found after offset.
      int getPreviousOffset​(int offset)
      Get the offset to the previous data item existing before this offset.
    • Method Detail

      • getData

        Data getData​(int offset)
        Get one Data item from the buffer at the current position plus offset.
        Parameters:
        offset - the displacement from the current position.
        Returns:
        the Data item at offset from the current position.
        Throws:
        AddressOutOfBoundsException - if offset exceeds address space
        java.lang.IndexOutOfBoundsException - if offset is negative
        MemoryAccessException - if memory cannot be read
      • getDataAfter

        Data getDataAfter​(int offset)
        Get the next data item starting after offset.
        Parameters:
        offset - offset to look after
        Returns:
        Data item starting after this offset
      • getDataBefore

        Data getDataBefore​(int offset)
        Get the previous data item starting before offset.
        Parameters:
        offset - offset to look before
        Returns:
        Data item starting before this offset
      • getNextOffset

        int getNextOffset​(int offset)
        Get the offset to the next data item found after offset.
        Parameters:
        offset - offset to look after
        Returns:
        offset of the first data item existing after this one.
      • getPreviousOffset

        int getPreviousOffset​(int offset)
        Get the offset to the previous data item existing before this offset.
        Parameters:
        offset - offset to look before
        Returns:
        offset of the first data item existing before this one.
      • getData

        Data[] getData​(int start,
                       int end)
        Get an array of data items that begin at or after start up to end. Data items that exist before start are not returned Data items that exist before end, but terminate after end ARE returned
        Parameters:
        start - start offset
        end - end offset
        Returns:
        array of CodeDatas that exist between start and end.
      • getAddress

        Address getAddress()
        Get the Address which corresponds to the offset 0.
        Returns:
        the current address of offset 0.