Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5067481

DOC: MetaMessage.setMessage does not mention length bytes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Future Project
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs

      Name: fb126949 Date: 06/23/2004


      The specification for MetaMessage.setMessage(int type, byte[] data, int length) reads:

      "The type argument should be a valid value for the byte that follows the status byte in the MetaMessage. The data argument should contain all the subsequent bytes of the MetaMessage."

      The specification does not mention, however, that the length byte(s) are inserted implicitly by setMessage(), and that the byte array returned by getMessage() contains the length byte(s). It is arguable if that behavior is good -- System Exclusive messages do not insert the length byte(s) in Java Sound -- but it is implemented like this.

      The spec should be fixed to reflect the implementation. E.g.:

        * The <code>type</code> argument should be a valid
        * value for the byte that follows the status byte
        * in the <code>MetaMessage</code>. The
        * <code>data</code> argument should contain all
        * data bytes of the <code>MetaMessage</code>.
      ! * The byte that specifies the type of
      ! * <code>MetaMessage</code>, and the message length
      ! * data are not considered data bytes and should not be
      ! * included in <code>data</code>. Note that <code>
      ! * getMessage</code> will return the full meta message,
      ! * including type and length bytes.
        *
        * @param type meta-message type (must be less than 128)
      ! * @param data the data bytes in the meta message,
      ! * without type and length bytes
        * @param length the number of bytes in the
        * <code>data</code> byte array



      ======================================================================

            amenkov Alex Menkov
            fbomerssunw Florian Bomers (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: