Beispiel #1
0
  /**
   * row keyを文字列にdecode
   *
   * @param rowkey row key
   * @return 10進のshop_id-item_id
   */
  public static String decodeRowkey(byte[] rowkey) {
    int srcOffset = 0;
    byte[] bShopID = new byte[SIZE_OF_SHOP_ID_32];
    System.arraycopy(rowkey, srcOffset, bShopID, 0, SIZE_OF_SHOP_ID_32);
    srcOffset += SIZE_OF_SHOP_ID_32;

    byte[] bItemID = new byte[SIZE_OF_ITEM_ID_32];
    System.arraycopy(rowkey, srcOffset, bItemID, 0, SIZE_OF_ITEM_ID_32);

    long shopID = ByteArray.toDecimal(bShopID);
    long itemID = ByteArray.toDecimal(bItemID);

    return String.format("%d-%d", shopID, itemID);
  }