Class MamaMsg


  • public class MamaMsg
    extends java.lang.Object
    • Constructor Detail

      • MamaMsg

        public MamaMsg()
        The default construction behaviour is to create the underlying C message structure. We need this when users are creating their own messages when using the publishing API.
      • MamaMsg

        public MamaMsg​(char payloadId)
        Create a MamaMsg.
        Parameters:
        payloadId - The identifier of the payload to be used.
      • MamaMsg

        public MamaMsg​(MamaPayloadBridge payloadBridge)
        Create a MamaMsg.
        Parameters:
        MamaPayloadBridge -
    • Method Detail

      • getStringAsBuffer

        public MamaBuffer getStringAsBuffer​(MamaFieldDescriptor fieldDesc)
        This function will obtain a string from the mama message and return it inside a MamaBuffer object without performing any memory allocation that would cause future garbage collection.
        Returns:
        A MamaBuffer containing single byte ASCII characters, to obtain a unicode string call MamaBuffer.asCharBuffer.
        Throws:
        com.wombat.common.WombatException - Thrown if the field descriptor is null.
      • getStringAsBuffer

        public MamaBuffer getStringAsBuffer​(java.lang.String name,
                                            int fid)
        This function will obtain a string from the mama message and return it inside a MamaBuffer object without performing any memory allocation that would cause future garbage collection.
        Returns:
        A MamaBuffer containing single byte ASCII characters, to obtain a unicode string call MamaBuffer.asCharBuffer.
      • tryStringAsBuffer

        public boolean tryStringAsBuffer​(java.lang.String name,
                                         int fid,
                                         MamaBuffer mamaBuffer)
        This function will obtain a string from the mama message and return it inside a MamaBuffer object without performing any memory allocation that would cause future garbage collection. If the field is not in the message the function will return FALSE.
        Returns:
        Boolean indicating of the field was present in the message or not.
      • getPointerVal

        public long getPointerVal()
      • iterator

        public java.util.Iterator iterator​(MamaDictionary dictionary)
      • iterator

        public java.util.Iterator iterator()
      • getNumFields

        public int getNumFields()
      • getBoolean

        public boolean getBoolean​(java.lang.String name,
                                  int fid)
      • getChar

        public char getChar​(java.lang.String name,
                            int fid)
      • getI8

        public byte getI8​(java.lang.String name,
                          int fid)
      • getU8

        public short getU8​(java.lang.String name,
                           int fid)
      • getI16

        public short getI16​(java.lang.String name,
                            int fid)
      • getU16

        public int getU16​(java.lang.String name,
                          int fid)
      • getI32

        public int getI32​(java.lang.String name,
                          int fid)
      • getU32

        public long getU32​(java.lang.String name,
                           int fid)
      • getI64

        public long getI64​(java.lang.String name,
                           int fid)
      • getU64

        public long getU64​(java.lang.String name,
                           int fid)
      • getF32

        public float getF32​(java.lang.String name,
                            int fid)
      • getF64

        public double getF64​(java.lang.String name,
                             int fid)
      • getString

        public java.lang.String getString​(java.lang.String name,
                                          int fid)
      • getMsg

        public MamaMsg getMsg​(java.lang.String name,
                              int fid)
      • getByteBuffer

        public byte[] getByteBuffer()
        Return the internal message buffer as an array of bytes which is suitable for writing to a file. Note that this is a copy of the bytes in the current buffer.
        Returns:
        The byte array containing the message wire format
      • createFromByteBuffer

        public void createFromByteBuffer​(byte[] byteArray)
        Create a mamaMsg from the provided byte buffer. This function causes a memory buffer to be allocated that is persisted for the lifetime of the message. Therefore calling this function a second time will cause an error. Instead destroy the message and then re-created it using this function.
        Parameters:
        byteArray - The byte array containing the wire format of the message
      • setNewBuffer

        public void setNewBuffer​(byte[] byteArray)
        Set a new buffer for an existing mamaMsg. This approach is faster than creating a new message for buffers as the message can reuse memory allocated during previous use.
        Parameters:
        byteArray - The byte array containing the wire format of the message
      • getOpaque

        public byte[] getOpaque​(java.lang.String name,
                                int fid)
      • getDateTime

        public MamaDateTime getDateTime​(java.lang.String name,
                                        int fid)
      • getPrice

        public MamaPrice getPrice​(java.lang.String name,
                                  int fid)
      • getArrayMsg

        public MamaMsg[] getArrayMsg​(java.lang.String name,
                                     int fid)
      • getArrayI8

        public byte[] getArrayI8​(java.lang.String name,
                                 int fid)
      • getArrayU8

        public short[] getArrayU8​(java.lang.String name,
                                  int fid)
      • getArrayI16

        public short[] getArrayI16​(java.lang.String name,
                                   int fid)
      • getArrayU16

        public int[] getArrayU16​(java.lang.String name,
                                 int fid)
      • getArrayI32

        public int[] getArrayI32​(java.lang.String name,
                                 int fid)
      • getArrayU32

        public long[] getArrayU32​(java.lang.String name,
                                  int fid)
      • getArrayI64

        public long[] getArrayI64​(java.lang.String name,
                                  int fid)
      • getArrayU64

        public long[] getArrayU64​(java.lang.String name,
                                  int fid)
      • getArrayF32

        public float[] getArrayF32​(java.lang.String name,
                                   int fid)
      • getArrayF64

        public double[] getArrayF64​(java.lang.String name,
                                    int fid)
      • getArrayString

        public java.lang.String[] getArrayString​(java.lang.String name,
                                                 int fid)
      • getIsDefinitelyDuplicate

        public boolean getIsDefinitelyDuplicate()
      • getIsPossiblyDuplicate

        public boolean getIsPossiblyDuplicate()
      • getIsPossiblyDelayed

        public boolean getIsPossiblyDelayed()
      • getIsDefinitelyDelayed

        public boolean getIsDefinitelyDelayed()
      • getIsOutOfSequence

        public boolean getIsOutOfSequence()
      • getSeqNum

        public long getSeqNum()
      • addBool

        public void addBool​(java.lang.String name,
                            int fid,
                            boolean value)
      • addBoolean

        public void addBoolean​(java.lang.String name,
                               int fid,
                               boolean value)
      • addChar

        public void addChar​(java.lang.String name,
                            int fid,
                            char value)
      • addI8

        public void addI8​(java.lang.String name,
                          int fid,
                          byte value)
      • addU8

        public void addU8​(java.lang.String name,
                          int fid,
                          short value)
      • addI16

        public void addI16​(java.lang.String name,
                           int fid,
                           short value)
      • addU16

        public void addU16​(java.lang.String name,
                           int fid,
                           int value)
      • addI32

        public void addI32​(java.lang.String name,
                           int fid,
                           int value)
      • addU32

        public void addU32​(java.lang.String name,
                           int fid,
                           long value)
      • addI64

        public void addI64​(java.lang.String name,
                           int fid,
                           long value)
      • addU64

        public void addU64​(java.lang.String name,
                           int fid,
                           long value)
      • addF32

        public void addF32​(java.lang.String name,
                           int fid,
                           float value)
      • addF64

        public void addF64​(java.lang.String name,
                           int fid,
                           double value)
      • addString

        public void addString​(java.lang.String name,
                              int fid,
                              java.lang.String value)
      • addDateTime

        public void addDateTime​(java.lang.String name,
                                int fid,
                                MamaDateTime value)
      • addPrice

        public void addPrice​(java.lang.String name,
                             int fid,
                             MamaPrice value)
      • addMsg

        public void addMsg​(java.lang.String name,
                           int fid,
                           MamaMsg value)
      • addOpaque

        public void addOpaque​(java.lang.String name,
                              int fid,
                              byte[] value)
      • addArrayI8

        public void addArrayI8​(java.lang.String name,
                               int fid,
                               byte[] value)
      • addArrayU8

        public void addArrayU8​(java.lang.String name,
                               int fid,
                               short[] value)
      • addArrayI16

        public void addArrayI16​(java.lang.String name,
                                int fid,
                                short[] value)
      • addArrayU16

        public void addArrayU16​(java.lang.String name,
                                int fid,
                                int[] value)
      • addArrayI32

        public void addArrayI32​(java.lang.String name,
                                int fid,
                                int[] value)
      • addArrayU32

        public void addArrayU32​(java.lang.String name,
                                int fid,
                                long[] value)
      • addArrayI64

        public void addArrayI64​(java.lang.String name,
                                int fid,
                                long[] value)
      • addArrayU64

        public void addArrayU64​(java.lang.String name,
                                int fid,
                                long[] value)
      • addArrayF32

        public void addArrayF32​(java.lang.String name,
                                int fid,
                                float[] value)
      • addArrayF64

        public void addArrayF64​(java.lang.String name,
                                int fid,
                                double[] value)
      • addArrayMsg

        public void addArrayMsg​(java.lang.String name,
                                int fid,
                                MamaMsg[] value)
      • addArrayMsgWithLength

        public void addArrayMsgWithLength​(java.lang.String name,
                                          int fid,
                                          MamaMsg[] value,
                                          int length)
        This function will add a new field containing an array of messages. Unlinke addArrayMsg it will not add the entire array but only the number of messages supplied in the length parameter.
        Parameters:
        name - (in) the field name.
        fid - (in) the field id.
        value - (in) the array of messages.
        length - (in) the number of messages to add from the array, if this parameter is outside the array bounds then an exception will be thrown.
        Throws:
        MamaException
      • addArrayString

        public void addArrayString​(java.lang.String name,
                                   int fid,
                                   java.lang.String[] value,
                                   int length)
      • addArrayString

        public void addArrayString​(java.lang.String name,
                                   int fid,
                                   java.lang.String[] value)
      • updateI8

        public void updateI8​(java.lang.String name,
                             int fid,
                             byte value)
      • updateU8

        public void updateU8​(java.lang.String name,
                             int fid,
                             short value)
      • updateI16

        public void updateI16​(java.lang.String name,
                              int fid,
                              short value)
      • updateU16

        public void updateU16​(java.lang.String name,
                              int fid,
                              int value)
      • updateI32

        public void updateI32​(java.lang.String name,
                              int fid,
                              int value)
      • updateU32

        public void updateU32​(java.lang.String name,
                              int fid,
                              long value)
      • updateI64

        public void updateI64​(java.lang.String name,
                              int fid,
                              long value)
      • updateU64

        public void updateU64​(java.lang.String name,
                              int fid,
                              long value)
      • updateF32

        public void updateF32​(java.lang.String name,
                              int fid,
                              float value)
      • updateF64

        public void updateF64​(java.lang.String name,
                              int fid,
                              double value)
      • updateString

        public void updateString​(java.lang.String name,
                                 int fid,
                                 java.lang.String value)
      • updatePrice

        public void updatePrice​(java.lang.String name,
                                int fid,
                                MamaPrice value)
      • updateBoolean

        public void updateBoolean​(java.lang.String name,
                                  int fid,
                                  boolean value)
      • updateChar

        public void updateChar​(java.lang.String name,
                               int fid,
                               char value)
      • updateDateTime

        public void updateDateTime​(java.lang.String name,
                                   int fid,
                                   MamaDateTime value)
      • updateArrayI8

        public void updateArrayI8​(java.lang.String name,
                                  int fid,
                                  byte[] value)
      • updateArrayU8

        public void updateArrayU8​(java.lang.String name,
                                  int fid,
                                  short[] value)
      • updateArrayI16

        public void updateArrayI16​(java.lang.String name,
                                   int fid,
                                   short[] value)
      • updateArrayU16

        public void updateArrayU16​(java.lang.String name,
                                   int fid,
                                   int[] value)
      • updateArrayI32

        public void updateArrayI32​(java.lang.String name,
                                   int fid,
                                   int[] value)
      • updateArrayU32

        public void updateArrayU32​(java.lang.String name,
                                   int fid,
                                   long[] value)
      • updateArrayI64

        public void updateArrayI64​(java.lang.String name,
                                   int fid,
                                   long[] value)
      • updateArrayU64

        public void updateArrayU64​(java.lang.String name,
                                   int fid,
                                   long[] value)
      • updateArrayF32

        public void updateArrayF32​(java.lang.String name,
                                   int fid,
                                   float[] value)
      • updateArrayF64

        public void updateArrayF64​(java.lang.String name,
                                   int fid,
                                   double[] value)
      • getChar

        public char getChar​(java.lang.String name,
                            int fid,
                            char defaultValue)
      • getI8

        public byte getI8​(java.lang.String name,
                          int fid,
                          byte defaultValue)
      • getU8

        public short getU8​(java.lang.String name,
                           int fid,
                           short defaultValue)
      • getI16

        public short getI16​(java.lang.String name,
                            int fid,
                            short defaultValue)
      • getU16

        public int getU16​(java.lang.String name,
                          int fid,
                          int defaultValue)
      • getI32

        public int getI32​(java.lang.String name,
                          int fid,
                          int defaultValue)
      • getU32

        public long getU32​(java.lang.String name,
                           int fid,
                           long defaultValue)
      • getI64

        public long getI64​(java.lang.String name,
                           int fid,
                           long defaultValue)
      • getU64

        public long getU64​(java.lang.String name,
                           int fid,
                           long defaultValue)
      • getF32

        public float getF32​(java.lang.String name,
                            int fid,
                            float defaultValue)
      • getF64

        public double getF64​(java.lang.String name,
                             int fid,
                             double defaultValue)
      • getString

        public java.lang.String getString​(java.lang.String name,
                                          int fid,
                                          java.lang.String defaultValue)
      • getString

        public java.lang.String getString​(MamaFieldDescriptor fieldDesc,
                                          java.lang.String defaultValue)
      • getPrice

        public MamaPrice getPrice​(java.lang.String name,
                                  int fid,
                                  MamaPrice defaultValue)
      • getArrayI32

        public int[] getArrayI32​(MamaFieldDescriptor fieldDesc,
                                 int[] defaultValue)
      • tryBoolean

        public boolean tryBoolean​(java.lang.String name,
                                  int fid,
                                  MamaBoolean result)
      • tryChar

        public boolean tryChar​(java.lang.String name,
                               int fid,
                               MamaChar result)
      • tryI8

        public boolean tryI8​(java.lang.String name,
                             int fid,
                             MamaByte result)
      • tryU8

        public boolean tryU8​(java.lang.String name,
                             int fid,
                             MamaShort result)
      • tryI16

        public boolean tryI16​(java.lang.String name,
                              int fid,
                              MamaShort result)
      • tryU16

        public boolean tryU16​(java.lang.String name,
                              int fid,
                              MamaInteger result)
      • tryI32

        public boolean tryI32​(java.lang.String name,
                              int fid,
                              MamaInteger result)
      • tryU32

        public boolean tryU32​(java.lang.String name,
                              int fid,
                              MamaLong result)
      • tryI64

        public boolean tryI64​(java.lang.String name,
                              int fid,
                              MamaLong result)
      • tryU64

        public boolean tryU64​(java.lang.String name,
                              int fid,
                              MamaLong result)
      • tryF32

        public boolean tryF32​(java.lang.String name,
                              int fid,
                              MamaFloat result)
      • tryF64

        public boolean tryF64​(java.lang.String name,
                              int fid,
                              MamaDouble result)
      • tryDateTime

        public boolean tryDateTime​(java.lang.String name,
                                   int fid,
                                   MamaDateTime result)
      • tryPrice

        public boolean tryPrice​(java.lang.String name,
                                int fid,
                                MamaPrice result)
      • tryString

        public boolean tryString​(java.lang.String name,
                                 int fid,
                                 MamaString result)
      • tryOpaque

        public boolean tryOpaque​(java.lang.String name,
                                 int fid,
                                 MamaOpaque result)
      • tryMsg

        public boolean tryMsg​(java.lang.String name,
                              int fid,
                              MamaMessage result)
      • tryArrayI32

        public boolean tryArrayI32​(java.lang.String name,
                                   int fid,
                                   MamaArrayInt result)
      • tryArrayU16

        public boolean tryArrayU16​(java.lang.String name,
                                   int fid,
                                   MamaArrayInt result)
      • tryArrayMsg

        public boolean tryArrayMsg​(java.lang.String name,
                                   int fid,
                                   MamaArrayMsg result)
      • tryArrayString

        public boolean tryArrayString​(java.lang.String name,
                                      int fid,
                                      MamaArrayString result)
      • getFieldAsString

        public java.lang.String getFieldAsString​(int fid,
                                                 MamaDictionary dictionary)
      • isFromInbox

        public boolean isFromInbox()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getPayloadType

        public char getPayloadType()
        Return as a character representation of the payload type used in the message.
        Returns:
        A MamaPayloadType indicating which message payload is used in the message.
      • destroy

        public void destroy()
      • clear

        public void clear()
      • copy

        public void copy​(MamaMsg rhs)
      • apply

        public void apply​(MamaMsg rhs)
      • _getField

        public void _getField​(java.lang.String fieldName,
                              int fid,
                              MamaDictionary dict)