Class CharsetBOCU1.CharsetEncoderBOCU

    • Field Detail

      • sourceIndex

        int sourceIndex
      • nextSourceIndex

        int nextSourceIndex
      • prev

        int prev
      • c

        int c
      • diff

        int diff
      • checkNegative

        boolean checkNegative
      • LoopAfterTrail

        boolean LoopAfterTrail
      • targetCapacity

        int targetCapacity
      • cr

        java.nio.charset.CoderResult cr
      • LabelLoop

        private boolean LabelLoop
      • labelType

        private int labelType
    • Constructor Detail

      • CharsetEncoderBOCU

        public CharsetEncoderBOCU​(CharsetICU cs)
    • Method Detail

      • NEGDIVMOD

        private int NEGDIVMOD​(int n,
                              int d,
                              int m)
        Integer division and modulo with negative numerators yields negative modulo results and quotients that are one more than what we need here. This macro adjust the results so that the modulo-value m is always >=0. For positive n, the if() condition is always false.
        Parameters:
        n - Number to be split into quotient and rest. Will be modified to contain the quotient.
        d - Divisor.
        m - Output variable for the rest (modulo result).
      • packDiff

        private int packDiff​(int n)
        Encode a difference -0x10ffff..0x10ffff in 1..4 bytes and return a packed integer with them. The encoding favors small absolute differences with short encodings to compress runs of same-script characters. Optimized version with unrolled loops and fewer floating-point operations than the standard packDiff().
        Parameters:
        diff - difference value -0x10ffff..0x10ffff
        Returns:
        0x010000zz for 1-byte sequence zz 0x0200yyzz for 2-byte sequence yy zz 0x03xxyyzz for 3-byte sequence xx yy zz 0xwwxxyyzz for 4-byte sequence ww xx yy zz (ww>0x03)
      • encodeLoop

        protected java.nio.charset.CoderResult encodeLoop​(java.nio.CharBuffer source,
                                                          java.nio.ByteBuffer target,
                                                          java.nio.IntBuffer offsets,
                                                          boolean flush)
        Specified by:
        encodeLoop in class CharsetEncoderICU
      • fastSingle

        private int fastSingle​(java.nio.CharBuffer source,
                               java.nio.ByteBuffer target,
                               java.nio.IntBuffer offsets)
      • getTrail

        private int getTrail​(java.nio.CharBuffer source,
                             java.nio.ByteBuffer target,
                             java.nio.IntBuffer offsets)
      • regularLoop

        private int regularLoop​(java.nio.CharBuffer source,
                                java.nio.ByteBuffer target,
                                java.nio.IntBuffer offsets)