Class CharsetBOCU1.CharsetEncoderBOCU

Enclosing class:
CharsetBOCU1

class CharsetBOCU1.CharsetEncoderBOCU extends CharsetEncoderICU
  • Field Details

    • 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

    • fastSingle

      private static final int fastSingle
      See Also:
    • getTrail

      private static final int getTrail
      See Also:
    • regularLoop

      private static final int regularLoop
      See Also:
    • LabelLoop

      private boolean LabelLoop
    • labelType

      private int labelType
  • Constructor Details

    • CharsetEncoderBOCU

      public CharsetEncoderBOCU(CharsetICU cs)
  • Method Details

    • 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 CoderResult encodeLoop(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush)
      Specified by:
      encodeLoop in class CharsetEncoderICU
    • fastSingle

      private int fastSingle(CharBuffer source, ByteBuffer target, IntBuffer offsets)
    • getTrail

      private int getTrail(CharBuffer source, ByteBuffer target, IntBuffer offsets)
    • regularLoop

      private int regularLoop(CharBuffer source, ByteBuffer target, IntBuffer offsets)