Class Utf8CodingException

  • All Implemented Interfaces:
    Serializable

    public final class Utf8CodingException
    extends RuntimeException
    This exception will be thrown for errors encountered during either the encoding of characters to Utf8 bytes, or the decoding of Utf8 bytes to characters.
    Author:
    Lee Rhodes
    See Also:
    Serialized Form
    • Constructor Detail

      • Utf8CodingException

        public Utf8CodingException​(String message)
        A coding exception occured processing UTF_8
        Parameters:
        message - the error message
    • Method Detail

      • shortUtf8DecodeByteSequence

        public static Utf8CodingException shortUtf8DecodeByteSequence​(byte leadByte,
                                                                      long address,
                                                                      long limit,
                                                                      int required)
        Exception for a short UTF_8 Decode Byte Sequence
        Parameters:
        leadByte - the given lead byte
        address - the given address
        limit - the given limit
        required - what is required
        Returns:
        the exception
      • illegalUtf8DecodeByteSequence

        public static Utf8CodingException illegalUtf8DecodeByteSequence​(byte[] bytes)
        Exception for an illegal UTF_8 Decode Byte Sequence
        Parameters:
        bytes - the illegal byte sequence
        Returns:
        the exception.
      • outOfMemory

        public static Utf8CodingException outOfMemory()
        Exception for out-of-memory
        Returns:
        the exception
      • unpairedSurrogate

        public static Utf8CodingException unpairedSurrogate​(char c)
        Exception for an unpaired surrogate
        Parameters:
        c - The last char to encode is an unpaired surrogate
        Returns:
        the exception plus the unpaired surrogate character
      • shortUtf8EncodeByteLength

        public static Utf8CodingException shortUtf8EncodeByteLength​(int remaining)
        Exception for a short UTF_8 encode byte length
        Parameters:
        remaining - The surrogate pair that is short
        Returns:
        the exception plus the surrogate pair that is short
      • illegalSurrogatePair

        public static Utf8CodingException illegalSurrogatePair​(char c1,
                                                               char c2)
        Exception for an illegal surrogate pair
        Parameters:
        c1 - the first character of the pair
        c2 - the second character of the pair
        Returns:
        the exception plus the illegal pair