java.nio.charset

Class CoderResult


  • public class CoderResult
    extends Object
    A description of the result state of a coder.

    A charset coder, that is, either a decoder or an encoder, consumes bytes (or characters) from an input buffer, translates them, and writes the resulting characters (or bytes) to an output buffer. A coding process terminates for one of four categories of reasons, which are described by instances of this class:

    • Underflow is reported when there is no more input to be processed, or there is insufficient input and additional input is required. This condition is represented by the unique result object UNDERFLOW, whose isUnderflow method returns true.

    • Overflow is reported when there is insufficient room remaining in the output buffer. This condition is represented by the unique result object OVERFLOW, whose isOverflow method returns true.

    • A malformed-input error is reported when a sequence of input units is not well-formed. Such errors are described by instances of this class whose isMalformed method returns true and whose length method returns the length of the malformed sequence. There is one unique instance of this class for all malformed-input errors of a given length.

    • An unmappable-character error is reported when a sequence of input units denotes a character that cannot be represented in the output charset. Such errors are described by instances of this class whose isUnmappable method returns true and whose length method returns the length of the input sequence denoting the unmappable character. There is one unique instance of this class for all unmappable-character errors of a given length.

    For convenience, the isError method returns true for result objects that describe malformed-input and unmappable-character errors but false for those that describe underflow or overflow conditions.

    Since:
    1.4
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static CoderResult OVERFLOW
      Result object indicating overflow, meaning that there is insufficient room in the output buffer.
      static CoderResult UNDERFLOW
      Result object indicating underflow, meaning that either the input buffer has been completely consumed or, if the input buffer is not yet empty, that additional input is required.

      Eerste pagina van API Java Inhoudsopgave Haut

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      boolean isError()
      Tells whether or not this object describes an error condition.
      boolean isMalformed()
      Tells whether or not this object describes a malformed-input error.
      boolean isOverflow()
      Tells whether or not this object describes an overflow condition.
      boolean isUnderflow()
      Tells whether or not this object describes an underflow condition.
      boolean isUnmappable()
      Tells whether or not this object describes an unmappable-character error.
      int length()
      Returns the length of the erroneous input described by this object  (optional operation).
      static CoderResult malformedForLength(int length)
      Static factory method that returns the unique object describing a malformed-input error of the given length.
      void throwException()
      Throws an exception appropriate to the result described by this object.
      String toString()
      Returns a string describing this coder result.
      static CoderResult unmappableForLength(int length)
      Static factory method that returns the unique result object describing an unmappable-character error of the given length.

      Eerste pagina van API Java Inhoudsopgave Haut

    • Field Detail

      • UNDERFLOW

        public static final CoderResult UNDERFLOW
        Result object indicating underflow, meaning that either the input buffer has been completely consumed or, if the input buffer is not yet empty, that additional input is required.

      • OVERFLOW

        public static final CoderResult OVERFLOW
        Result object indicating overflow, meaning that there is insufficient room in the output buffer.

    • Method Detail

      • toString

        public String toString()
        Returns a string describing this coder result.
        Overrides:
        toString in class Object
        Returns:
        A descriptive string
      • isUnderflow

        public boolean isUnderflow()
        Tells whether or not this object describes an underflow condition.

        Returns:
        true if, and only if, this object denotes underflow
      • isOverflow

        public boolean isOverflow()
        Tells whether or not this object describes an overflow condition.

        Returns:
        true if, and only if, this object denotes overflow
      • isError

        public boolean isError()
        Tells whether or not this object describes an error condition.

        Returns:
        true if, and only if, this object denotes either a malformed-input error or an unmappable-character error
      • isMalformed

        public boolean isMalformed()
        Tells whether or not this object describes a malformed-input error.

        Returns:
        true if, and only if, this object denotes a malformed-input error
      • isUnmappable

        public boolean isUnmappable()
        Tells whether or not this object describes an unmappable-character error.

        Returns:
        true if, and only if, this object denotes an unmappable-character error
      • length

        public int length()
        Returns the length of the erroneous input described by this object  (optional operation).

        Returns:
        The length of the erroneous input, a positive integer
        Throws:
        UnsupportedOperationException - If this object does not describe an error condition, that is, if the isError does not return true
      • malformedForLength

        public static CoderResult malformedForLength(int length)
        Static factory method that returns the unique object describing a malformed-input error of the given length.

        Returns:
        The requested coder-result object
      • unmappableForLength

        public static CoderResult unmappableForLength(int length)
        Static factory method that returns the unique result object describing an unmappable-character error of the given length.

        Returns:
        The requested coder-result object

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/nio/charset/coderresult.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut