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

Add minBytesPerSequence() to java.nio.charsets.CharsetEncoder

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • None
    • None
    • core-libs

    Description

      Charsets which are prefixed by a BOM need to include the size of it into maxBytesPerChar() to fulfil bug JDK-8230531.

      The downside is, that the buffer, calculated from maxBytesPerChar(), is near twice in size than needed.

      With this new API, the actually needed buffer size could be calculated with:

          int bufSize = encoder.minBytesPerSequence() + (encoder.maxBytesPerChar() - encoder.minBytesPerSequence()) * sequenceLength;
          // or
          int bufSize = encoder.maxBytesPerChar() * sequenceLength - encoder.minBytesPerSequence() * (sequenceLength - 1);

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              ulfzibis Ulf Zibis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: