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

Handler.setEncoding should have Charset overload

    XMLWordPrintable

Details

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

    Description

      The java.util.logging.Handler class has a setEncoding(String encoding) method. Methods that use an encoding string (elsewhere known as a charset name) throw UnsupportedEncodingException, which is a checked exception and is inconvenient for callers. Most of the APIs in the JDK have overloads or alternatives that take a Charset instead of a charset name, avoiding the need to declare a checked exception, and allowing the use of pre-declared Charsets in the StandardCharsets class.

      An alternative method (setCharset?) should be added to set the charset of a Handler.

      There is also a getEncoding() method that returns the encoding string; for symmetry it might also be useful to add something like getCharset() that returns the Charset used by this Handler.

      Attachments

        Activity

          People

            dfuchs Daniel Fuchs
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: