java.nio.charset.spi

Class CharsetProvider


  • public abstract class CharsetProvider
    extends Object
    Charset service-provider class.

    A charset provider is a concrete subclass of this class that has a zero-argument constructor and some number of associated charset implementation classes. Charset providers may be installed in an instance of the Java platform as extensions, that is, jar files placed into any of the usual extension directories. Providers may also be made available by adding them to the applet or application class path or by some other platform-specific means. Charset providers are looked up via the current thread's context class loader.

    A charset provider identifies itself with a provider-configuration file named java.nio.charset.spi.CharsetProvider in the resource directory META-INF/services. The file should contain a list of fully-qualified concrete charset-provider class names, one per line. A line is terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a line feed. Space and tab characters surrounding each name, as well as blank lines, are ignored. The comment character is '#' ('\u0023'); on each line all characters following the first comment character are ignored. The file must be encoded in UTF-8.

    If a particular concrete charset provider class is named in more than one configuration file, or is named in the same configuration file more than once, then the duplicates will be ignored. The configuration file naming a particular provider need not be in the same jar file or other distribution unit as the provider itself. The provider must be accessible from the same class loader that was initially queried to locate the configuration file; this is not necessarily the class loader that loaded the file.

    Since:
    1.4
    See Also:
    Charset
    • Constructor Detail

      • CharsetProvider

        protected CharsetProvider()
        Initializes a new charset provider.

        Throws:
        SecurityException - If a security manager has been installed and it denies RuntimePermission("charsetProvider")
    • Method Detail

      • charsets

        public abstract Iterator<Charset> charsets()
        Creates an iterator that iterates over the charsets supported by this provider. This method is used in the implementation of the Charset.availableCharsets method.

        Returns:
        The new iterator
      • charsetForName

        public abstract Charset charsetForName(String charsetName)
        Retrieves a charset for the given charset name.

        Parameters:
        charsetName - The name of the requested charset; may be either a canonical name or an alias
        Returns:
        A charset object for the named charset, or null if the named charset is not supported by this provider

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Table des matières Haut

Document créé le 01/09/2006, dernière modification le 29/10/2018
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/nio/charset/spi/charsetprovider.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, CharsetProvider

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut