Class Message


  • public class Message
    extends Object
    Encapsolates a complete BUFR message. A message has a DataDescriptor and one or more "datasets" aka "data subsets" aka "observations" aka "obs". Table lookup is done through getLookup().
    • Method Detail

      • getNumberDatasets

        public int getNumberDatasets()
        Get number of datasets in this message.
        Returns:
        number of datasets in this message
      • setHeader

        public void setHeader​(String header)
      • getHeader

        public String getHeader()
      • setStartPos

        public void setStartPos​(long startPos)
      • getStartPos

        public long getStartPos()
      • setRawBytes

        public void setRawBytes​(byte[] raw)
      • getRawBytes

        public byte[] getRawBytes()
      • extractWMO

        public String extractWMO()
      • getMessageSize

        public long getMessageSize()
        Get the byte length of the entire BUFR record.
        Returns:
        length in bytes of BUFR record
      • getRootDataDescriptor

        public DataDescriptor getRootDataDescriptor()
        Get the root of the DataDescriptor tree.
        Returns:
        root DataDescriptor
      • containsBufrTable

        public boolean containsBufrTable()
        Check if this message contains a BUFR table
        Returns:
        true if message contains a BUFR table
      • isTablesComplete

        public boolean isTablesComplete()
        Check if all descriptors were found in the tables.
        Returns:
        true if all dds were found.
      • isBitCountOk

        public boolean isBitCountOk()
      • getCountedDataBytes

        public int getCountedDataBytes()
      • getCountedDataBits

        public int getCountedDataBits()
      • getBitCounterUncompressed

        public BitCounterUncompressed getBitCounterUncompressed​(int obsOffsetInMessage)
        Get the offset of this obs from the start of the message data. Use only for non compressed data
        Parameters:
        obsOffsetInMessage - index of obs in the message
        Returns:
        offset in bits

        public int getBitOffset(int obsOffsetInMessage) { if (dds.isCompressed()) throw new IllegalArgumentException("cant call BufrMessage.getBitOffset() on compressed message");

        if (!root.isVarLength) return root.total_nbits * obsOffsetInMessage;

        getTotalBits(); // make sure its been set return nestedTableCounter[obsOffsetInMessage].getStartBit(); }

      • getTotalBits

        public int getTotalBits()
        This is the total number of bits taken by the data in the data section of the message. This is the counted number.
        Returns:
        total number of bits
      • calcTotalBits

        public int calcTotalBits​(Formatter out)
      • hashCode

        public int hashCode()
        Override hashcode to be consistent with equals.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code of dds.getDescriptors()
      • getDDShashcode

        public int getDDShashcode()
      • equals

        public boolean equals​(Object obj)
        BufrMessage is equal if they have the same dds.
        Overrides:
        equals in class Object
        Parameters:
        obj - other BufrMessage
        Returns:
        true if equals
      • dumpHeader

        public void dumpHeader​(Formatter out)
      • dumpHeaderShort

        public void dumpHeaderShort​(Formatter out)