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

Encoders should implement isLegalReplacement(byte[] repl)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 7
    • Component/s: core-libs
    • Labels:

      Description

      CharsetEncoder provides an implementation of isLegalReplacement,
      but it is not very efficient.

           * <p> The default implementation of this method is not very efficient; it
           * should generally be overridden to improve performance. </p>
           *
            */
          public boolean isLegalReplacement(byte[] repl) {

      The intent was likely that JDK-provided Encoders would implement this,
      but it has not happened.

      This is particularly important because creation of an Encoder causes an
      entire decoding operation to be performed, which makes creation of Encoders
      much more expensive than creation of Decoders.

      For a number of Encoders, the implementation is a trivial { return true; }

        Attachments

          Activity

            People

            • Assignee:
              sherman Xueming Shen
              Reporter:
              martin Martin Buchholz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: