Class OptimizedUTF8Encoder

    • Constructor Detail

      • OptimizedUTF8Encoder

        OptimizedUTF8Encoder()
    • Method Detail

      • getCharArray

        char[] getCharArray​(int size)
        Returns a char[] to use for decoding. Will use member variable if size is small enough. This method must be called, and returned char[] only used, from synchronized block.
        Parameters:
        size - The needed size of returned char[].
        Returns:
        A char[] at least as long as length.
      • charDecode

        java.lang.String charDecode​(byte[] encodedString,
                                    int offset,
                                    int length)
                             throws java.io.IOException
        Decodes binary content to String by first converting to char[].
        Throws:
        java.io.IOException
      • decodeToChars

        static java.lang.String decodeToChars​(byte[] data,
                                              int offset,
                                              int length,
                                              char[] chars,
                                              int out)
                                       throws java.io.IOException
        Decodes data from offset with given length as utf-8 and gives each decoded code point to the codePointConsumer.
        Parameters:
        data - The byte[] to decode.
        offset - The starting index in data.
        length - The number of bytes in data to decode.
        codePointConsumer - The consumer of all decoded code points.
        Throws:
        java.io.IOException - If data is not valid utf-8 content.
      • checkByte

        private static void checkByte​(int ch,
                                      int pos,
                                      int len)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • checkMinimal

        private static void checkMinimal​(int ch,
                                         int minValue)
                                  throws java.io.IOException
        Throws:
        java.io.IOException