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

RFE: equals() should compare string in Encoding and Type

XMLWordPrintable

    • b24
    • generic
    • generic



      Name: fb126949 Date: 09/19/2003


      The classes AudioFormat.Encoding and AudioFileFormat.Type both compare the instance equality in the equals() method. However, this prevents 3rd-party vendors to publish a plug-in with a new encoding/type, since only one instance of it would be accepted.

      The problem is this: when a user wants to convert an audiostream to a format that is offered by an installed plug-in (e.g. mp3 encoder), he uses the method AudioSystem.getAudioInputStream(AudioFormat, AudioInputStream) for conversion. He needs to provide an AudioFormat instance with the mp3 encoding. The only way to do that is to instanciate an own instance of AudioFormat.Encoding. But due to the implementation of equals(), Java Sound will not do the conversion, since the Encoding instance is difeerent from the one provided by the plug-in, even if they have the same name.

      Encodings and Types are fully specified by their name, and not their instance.

      The deficiency of the current implementation lead Tritonus, an independent group that publishes Java Sound plug-ins, to establish a quasi-standard repository which makes sure that only unique instances of Encoding and Type are used in the plug-ins and from the user. Such a repository contradicts Java Sound's idea of being open for new plug-ins.


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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: