Class JedisClusterCRC16

java.lang.Object
redis.clients.jedis.util.JedisClusterCRC16

public final class JedisClusterCRC16 extends Object
CRC16 Implementation according to CCITT standard Polynomial : 1021 (x^16 + x^12 + x^5 + 1) See Appendix A. CRC16 reference implementation in ANSI C
  • Field Details

    • LOOKUP_TABLE

      private static final int[] LOOKUP_TABLE
  • Constructor Details

    • JedisClusterCRC16

      private JedisClusterCRC16()
  • Method Details

    • getSlot

      public static int getSlot(String key)
    • getSlot

      public static int getSlot(byte[] key)
    • getCRC16

      public static int getCRC16(byte[] bytes, int s, int e)
      Create a CRC16 checksum from the bytes. implementation is from mp911de/lettuce, modified with some more optimizations
      Parameters:
      bytes -
      s -
      e -
      Returns:
      CRC16 as integer value See Issue 733
    • getCRC16

      public static int getCRC16(byte[] bytes)
    • getCRC16

      public static int getCRC16(String key)